src/PubSub/Manager.php
public function unsubscribe($eventName, $callable)
    {
        if (!isset($this->subscribers[$eventName])) {
            return;
        }
        if ($this->isClosureFactory($callable)) {
            // factory / lazy subscriber
            $callable[0] = $callable[0]();
        }
        foreach ($this->subscribers[$eventName] as $priority => $subscribers) {
            foreach ($subscribers as $k => $v) {
                if ($v !== $callable && $this->isClosureFactory($v)) {
                    $v[0] = $v[0]();
                }
                if ($v === $callable) {
                    unset($subscribers[$k], $this->sorted[$eventName]);
                } else {
                    $subscribers[$k] = $v;
                }
            }
            if ($subscribers) {
                $this->subscribers[$eventName][$priority] = $subscribers;
            } else {
                unset($this->subscribers[$eventName][$priority]);
            }
        }
    }
public function unsubscribe($eventName, $callable)
    {
        if (!isset($this->subscribers[$eventName])) {
            return;
        }
        if ($this->isClosureFactory($callable)) {
            // factory / lazy subscriber
            $callable[0] = $callable[0]();
        }
        foreach ($this->subscribers[$eventName] as $priority => $subscribers) {
            foreach ($subscribers as $k => $v) {
                if ($v !== $callable && $this->isClosureFactory($v)) {
                    $v[0] = $v[0]();
                }
                if ($v === $callable) {
                    unset($subscribers[$k], $this->sorted[$eventName]);
                } else {
                    $subscribers[$k] = $v;
                }
            }
            if ($subscribers) {
                $this->subscribers[$eventName][$priority] = $subscribers;
            } else {
                unset($this->subscribers[$eventName][$priority]);
            }
        }
    }
public function unsubscribe ( $ eventName , $ callable ) { if ( ! isset ( $ this -> subscribers [ $ eventName ] ) ) { return ; } if ( $ this -> isClosureFactory ( $ callable ) ) { // factory / lazy subscriber $ callable [ 0 ] = $ callable [ 0 ] ( ) ; } foreach ( $ this -> subscribers [ $ eventName ] as $ priority => $ subscribers ) { foreach ( $ subscribers as $ k => $ v ) { if ( $ v !== $ callable && $ this -> isClosureFactory ( $ v ) ) { $ v [ 0 ] = $ v [ 0 ] ( ) ; } if ( $ v === $ callable ) { unset ( $ subscribers [ $ k ] , $ this -> sorted [ $ eventName ] ) ; } else { $ subscribers [ $ k ] = $ v ; } } if ( $ subscribers ) { $ this -> subscribers [ $ eventName ] [ $ priority ] = $ subscribers ; } else { unset ( $ this -> subscribers [ $ eventName ] [ $ priority ] ) ; } } }
Removes an event subscriber from the specified event.

@param string   $eventName The event we're unsubscribing from
@param callable $callable  The subscriber to remove

@return void
Removes an event subscriber from the specified event .