protected function removeListener(array $listeners , $eventObject , $callback) {
        if (isset($listeners[$eventObject->getName()])) {
            if (($index = array_search($callback, $listeners[$eventObject->getName()])) !== false) {
                unset($listeners[$eventObject->getName()][$index]);
                if(empty($listeners[$eventObject->getName()])) {
                    unset($listeners[$eventObject->getName()]);
                } else {
                    $listeners[$eventObject->getName()] = array_values($listeners[$eventObject->getName()]);
                }
            }
        }
        return $listeners;
    }
protected function removeListener(array $listeners , $eventObject , $callback) {
        if (isset($listeners[$eventObject->getName()])) {
            if (($index = array_search($callback, $listeners[$eventObject->getName()])) !== false) {
                unset($listeners[$eventObject->getName()][$index]);
                if(empty($listeners[$eventObject->getName()])) {
                    unset($listeners[$eventObject->getName()]);
                } else {
                    $listeners[$eventObject->getName()] = array_values($listeners[$eventObject->getName()]);
                }
            }
        }
        return $listeners;
    }
protected function removeListener ( array $ listeners , $ eventObject , $ callback ) { if ( isset ( $ listeners [ $ eventObject -> getName ( ) ] ) ) { if ( ( $ index = array_search ( $ callback , $ listeners [ $ eventObject -> getName ( ) ] ) ) !== false ) { unset ( $ listeners [ $ eventObject -> getName ( ) ] [ $ index ] ) ; if ( empty ( $ listeners [ $ eventObject -> getName ( ) ] ) ) { unset ( $ listeners [ $ eventObject -> getName ( ) ] ) ; } else { $ listeners [ $ eventObject -> getName ( ) ] = array_values ( $ listeners [ $ eventObject -> getName ( ) ] ) ; } } } return $ listeners ; }
remove listener from an event and delete event if it dosn't have any listeners
@param array $listeners
@param string $eventName
@param callable $callback
@return array
remove listener from an event and delete event if it dosn t have any listeners