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;
    }
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;
    }
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 ; }
Sets the hook callback function which will be called if exceptions will raise.

@param string   $hook
@param callable $callable

@return Retry
Sets the hook callback function which will be called if exceptions will raise .