public function exec(string $name)
    {
        if (isset($this->hooks[$name]) === false) {
            $this->logger->debug(
                "No hook definitions found for '{$name}'. Available hook "
                . "definitions",
                [array_keys($this->hooks)]
            );
            return null;
        }

        $return = [];
        $params = array_merge($this->params, array_slice(func_get_args(), 1));
        foreach ($this->hooks[$name] as $definition) {
            if ($this->stop === true) {
                $this->stop = false;
                $this->logger->info(
                    "Hook execution was interrupted for hook '{$name}'"
                );
                break;
            }

            $this->logger->info("Calling definition for hook '{$name}'");
            $this->logger->debug("Hook definition parameters", $params);
            $retVal = $definition(...$params);
            if ($retVal !== null) {
                $return[] = $retVal;
            }
        }

        return count($return) === 1 ? $return[0] : $return;
    }
public function exec(string $name)
    {
        if (isset($this->hooks[$name]) === false) {
            $this->logger->debug(
                "No hook definitions found for '{$name}'. Available hook "
                . "definitions",
                [array_keys($this->hooks)]
            );
            return null;
        }

        $return = [];
        $params = array_merge($this->params, array_slice(func_get_args(), 1));
        foreach ($this->hooks[$name] as $definition) {
            if ($this->stop === true) {
                $this->stop = false;
                $this->logger->info(
                    "Hook execution was interrupted for hook '{$name}'"
                );
                break;
            }

            $this->logger->info("Calling definition for hook '{$name}'");
            $this->logger->debug("Hook definition parameters", $params);
            $retVal = $definition(...$params);
            if ($retVal !== null) {
                $return[] = $retVal;
            }
        }

        return count($return) === 1 ? $return[0] : $return;
    }
public function exec ( string $ name ) { if ( isset ( $ this -> hooks [ $ name ] ) === false ) { $ this -> logger -> debug ( "No hook definitions found for '{$name}'. Available hook " . "definitions" , [ array_keys ( $ this -> hooks ) ] ) ; return null ; } $ return = [ ] ; $ params = array_merge ( $ this -> params , array_slice ( func_get_args ( ) , 1 ) ) ; foreach ( $ this -> hooks [ $ name ] as $ definition ) { if ( $ this -> stop === true ) { $ this -> stop = false ; $ this -> logger -> info ( "Hook execution was interrupted for hook '{$name}'" ) ; break ; } $ this -> logger -> info ( "Calling definition for hook '{$name}'" ) ; $ this -> logger -> debug ( "Hook definition parameters" , $ params ) ; $ retVal = $ definition ( ... $ params ) ; if ( $ retVal !== null ) { $ return [ ] = $ retVal ; } } return count ( $ return ) === 1 ? $ return [ 0 ] : $ return ; }
Execute hook definition

Execute all definitions for the retrieved hook names in the order that
they have been inserted, and store their return values in an array, if it
is not null. If only one definition was called, then return that
executions return value directly, if there were more calls, return all the
return values in an array.

@param string Hook name
@return mixed
Execute hook definition