src/States/ConsumerState.php
protected function endSubscription($subscriptionId = null)
    {
        if (!$subscriptionId) {
            $subscriptionId = $this->subscriptions->getLast()->getSubscriptionId();
        }
        if (!isset($this->subscriptions[$subscriptionId])) {
            throw new InvalidArgumentException(sprintf('%s is no active subscription!', $subscriptionId));
        }
        $subscription = $this->subscriptions[$subscriptionId];
        $this->getClient()->sendFrame(
            $this->getProtocol()->getUnsubscribeFrame(
                $subscription->getDestination(),
                $subscription->getSubscriptionId()
            )
        );
        IdGenerator::releaseId($subscription->getSubscriptionId());

        unset($this->subscriptions[$subscription->getSubscriptionId()]);

        if ($this->subscriptions->count() == 0) {
            return true;
        }
        return false;
    }
protected function endSubscription($subscriptionId = null)
    {
        if (!$subscriptionId) {
            $subscriptionId = $this->subscriptions->getLast()->getSubscriptionId();
        }
        if (!isset($this->subscriptions[$subscriptionId])) {
            throw new InvalidArgumentException(sprintf('%s is no active subscription!', $subscriptionId));
        }
        $subscription = $this->subscriptions[$subscriptionId];
        $this->getClient()->sendFrame(
            $this->getProtocol()->getUnsubscribeFrame(
                $subscription->getDestination(),
                $subscription->getSubscriptionId()
            )
        );
        IdGenerator::releaseId($subscription->getSubscriptionId());

        unset($this->subscriptions[$subscription->getSubscriptionId()]);

        if ($this->subscriptions->count() == 0) {
            return true;
        }
        return false;
    }
protected function endSubscription ( $ subscriptionId = null ) { if ( ! $ subscriptionId ) { $ subscriptionId = $ this -> subscriptions -> getLast ( ) -> getSubscriptionId ( ) ; } if ( ! isset ( $ this -> subscriptions [ $ subscriptionId ] ) ) { throw new InvalidArgumentException ( sprintf ( '%s is no active subscription!' , $ subscriptionId ) ) ; } $ subscription = $ this -> subscriptions [ $ subscriptionId ] ; $ this -> getClient ( ) -> sendFrame ( $ this -> getProtocol ( ) -> getUnsubscribeFrame ( $ subscription -> getDestination ( ) , $ subscription -> getSubscriptionId ( ) ) ) ; IdGenerator :: releaseId ( $ subscription -> getSubscriptionId ( ) ) ; unset ( $ this -> subscriptions [ $ subscription -> getSubscriptionId ( ) ] ) ; if ( $ this -> subscriptions -> count ( ) == 0 ) { return true ; } return false ; }
Closes given subscription or last opened.

@param string $subscriptionId
@return bool true if last one was closed
Closes given subscription or last opened .