Add hookModules

@param \CampaignChain\CoreBundle\Entity\Hook $hooks
@return Bundle
167834
public function addHook(\CampaignChain\CoreBundle\Entity\Hook $hooks)
    {
        $this->hooks[] = $hooks;

        return $this;
    }
647119
def add_io_hook(self, hook):
        
        def proxy(*args):
            hook(*args)

        self._io_hooks.append(proxy)

        return self.HookRemover(lambda: self._io_hooks.remove(proxy))
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
                    );
                });
        }
    }
1074756
public function addCampaignModule(\CampaignChain\CoreBundle\Entity\CampaignModule $campaignModules)
    {
        $this->campaignModules[] = $campaignModules;

        return $this;
    }
1315119
public function setHook(string $hook) : Hook
    {
        if (!Util::isValid($hook)) {
            throw new \RuntimeException('Invalid hook name');
        }
        $this->hookToExecute = $hook;
        return $this;
    }
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;
    }
1078128
public function addLocationModule(\CampaignChain\CoreBundle\Entity\LocationModule $locationModules)
    {
        $this->locationModules[] = $locationModules;

        return $this;
    }
996210
public function hooks() {
		// Start and commit the session.
		add_action( 'plugins_loaded', [ $this, 'start_session' ] );
		add_action( 'shutdown', [ $this, 'commit_session' ] );

		// Register the garbage collector.
		add_action( 'wp', [ $this, 'register_garbage_collection' ] );
		add_action( $this->get_schedule_name(), [ $this, 'cleanup_expired_sessions' ] );
	}
532033
def add_hook(hook, &block)
      fail ArgumentError, "Invalid hook `#{hook}'" unless\
        HOOKS.keys.include? hook
      fail ArgumentError, 'Block require' unless block_given?
      options[hook] = block
    end
798496
public function add(HookInterface ...$hooks): void
    {
        $this->hooks = array_values(
            array_unique(
                array_merge($this->hooks, $hooks),
                SORT_REGULAR
            )
        );
    }
1102309
public function update(string $hook, array $params = [])
    {
        $path = $this->buildHooksPath($hook);

        return $this->put($path, $params);
    }
1002592
function addHookByType(ctx, type, methodNames, fn) {
  let i = methodNames.length;

  // If no hook specified, add wildcard
  if (i === 0) {
    methodNames = ['*'];
    i = 1;
  }

  let hookType = `${type}Hooks`;

  if (!ctx[hookType]) ctx[hookType] = {};

  while (i--) {
    let methodName = methodNames[i];
    // for array method names
    if (Array.isArray(methodName)) {
      addHookByType(ctx, type, methodName, fn);
    } else {
      if (!ctx[hookType][methodName]) {
        ctx[hookType][methodName] = [fn];
      } else {
        ctx[hookType][methodName].push(fn);
      }
    }
  }
}
1127176
protected function migrateHook(Hook $hook)
    {
        $migrations = (array) $hook->getComposerHookKey('migrations', []);

        foreach ($migrations as $path) {
            if ($this->filesystem->isDirectory($hook->getPath().'/'.$path)) {
                $this->migrator->run($this->realPath([$path], $hook->getPath().'/')->all());
            } else {
                $this->migrator->runFiles($this->realPath([$path], $hook->getPath().'/')->all());
            }
        }
    }
1173715
public function installHook(string $hook, bool $ask)
    {
        $doIt = true;
        if ($ask) {
            $answer = $this->io->ask('  <info>Install \'' . $hook . '\' hook?</info> <comment>[y,n]</comment> ', 'y');
            $doIt   = IOUtil::answerToBool($answer);
        }

        if ($doIt) {
            $this->writeHookFile($hook);
        }
    }
259220
public function init($modules = null)
    {
        if (!isset($modules)) {
            $modules = $this->module->getEnabled();
        }

        foreach ((array) $modules as $module) {

            if (empty($module['hooks'])) {
                continue;
            }

            foreach ($module['hooks'] as $method) {
                $this->register($method, $module['class']);
            }
        }

        return $this->hooks;
    }
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;
	}
1086367
public function hooks()
    {
        $this->hook->action(
            $this->isAllowedArea($this->getArea()),
            [$this, 'handleAction']
        )->dispatch();

        if (! empty($this->getArgument('execution'))) {
            $this->hook->filter(
                'script_loader_tag',
                [$this, 'addExecutionTypes']
            )->dispatch();
        }
    }