src/Pentagonal/Hookable/Hookable.php
public function apply($hookName, $value)
    {
        $hookName = $this->sanitize($hookName);
        if (!$hookName) {
            return $value;
        }

        $args = array();
        // Do 'all' actions first.
        if (isset($this->filters['all'])) {
            $this->current[] = $hookName;
            $args = func_get_args();
            $this->callAll($args);
        }

        if (! isset($this->filters[$hookName])) {
            if (isset($this->filters['all'])) {
                array_pop($this->current);
            }
            return $value;
        }

        if (! isset($this->filters['all'])) {
            $this->current[] = $hookName;
        }

        // Sort.
        if (!isset($this->merged[$hookName])) {
            ksort($this->filters[$hookName]);
            $this->merged[$hookName] = true;
        }

        reset($this->filters[$hookName]);
        if (empty($args)) {
            $args = func_get_args();
        }
        do {
            foreach ((array) current($this->filters[$hookName]) as $fn_array) {
                if (!is_null($fn_array['function'])) {
                    $args[1] = $value;
                    $value = call_user_func_array(
                        $fn_array['function'],
                        array_slice($args, 1, (int) $fn_array['accepted_args'])
                    );
                }
            }
        } while (next($this->filters[$hookName]) !== false);

        array_pop($this->current);
        return $value;
    }
public function apply($hookName, $value)
    {
        $hookName = $this->sanitize($hookName);
        if (!$hookName) {
            return $value;
        }

        $args = array();
        // Do 'all' actions first.
        if (isset($this->filters['all'])) {
            $this->current[] = $hookName;
            $args = func_get_args();
            $this->callAll($args);
        }

        if (! isset($this->filters[$hookName])) {
            if (isset($this->filters['all'])) {
                array_pop($this->current);
            }
            return $value;
        }

        if (! isset($this->filters['all'])) {
            $this->current[] = $hookName;
        }

        // Sort.
        if (!isset($this->merged[$hookName])) {
            ksort($this->filters[$hookName]);
            $this->merged[$hookName] = true;
        }

        reset($this->filters[$hookName]);
        if (empty($args)) {
            $args = func_get_args();
        }
        do {
            foreach ((array) current($this->filters[$hookName]) as $fn_array) {
                if (!is_null($fn_array['function'])) {
                    $args[1] = $value;
                    $value = call_user_func_array(
                        $fn_array['function'],
                        array_slice($args, 1, (int) $fn_array['accepted_args'])
                    );
                }
            }
        } while (next($this->filters[$hookName]) !== false);

        array_pop($this->current);
        return $value;
    }
Applying Hooks for replaceable and returning as $value param

@param  string $hookName Hook Name replaceable
@param  mixed $value     returning value

@return mixed