public function register(callable $callback, $priority = null)
    {
        $priority = $this->getPriority($priority);
        if (!isset($this->callbacks[$priority])) {
            $this->callbacks[$priority] = [];
        }
        $this->callbacks[$priority][] = $callback;
        $this->lowestPriority = max($priority, $this->lowestPriority);
    }
public function register(callable $callback, $priority = null)
    {
        $priority = $this->getPriority($priority);
        if (!isset($this->callbacks[$priority])) {
            $this->callbacks[$priority] = [];
        }
        $this->callbacks[$priority][] = $callback;
        $this->lowestPriority = max($priority, $this->lowestPriority);
    }
public function register ( callable $ callback , $ priority = null ) { $ priority = $ this -> getPriority ( $ priority ) ; if ( ! isset ( $ this -> callbacks [ $ priority ] ) ) { $ this -> callbacks [ $ priority ] = [ ] ; } $ this -> callbacks [ $ priority ] [ ] = $ callback ; $ this -> lowestPriority = max ( $ priority , $ this -> lowestPriority ) ; }
Registers a callback to be called on shutdown.

@param callable $callback
@param null|int $priority The priority of the callback. Lowest number means higher priority.

@throws \InvalidArgumentException
Registers a callback to be called on shutdown .