Return subscription by subscription reference.

@return SubscriptionInterface
434981
public function getSubscription()
    {
        if ($this->getGateway() instanceof GatewayInterface) {
            return $this->getGateway()->getSubscriptionByReference($this->getSubscriptionReference());
        }

        throw new RuntimeException('Gateway is not set');
    }
1253219
final private function getRefClass()
    {
        if ($this->refClass === null) {
            $this->refClass = new \ReflectionClass($this);
        }

        return $this->refClass;
    }
899462
public function addSubscription(SubscriptionDefinition $subscription): Endpoint
    {
        if ($this->hasSubscription($subscription->getName())) {
            throw new \RuntimeException(sprintf('Duplicate definition for subscription with name "%s"', $subscription->getName()));
        }
        if (!is_a($subscription->getResolver(), EmptyObjectResolver::class, true)) {
            $this->subscriptionsMap[$subscription->getName()] = $subscription->getResolver();
        }
        $this->subscriptions[$subscription->getName()] = $subscription;

        return $this;
    }
527365
protected function getServiceLocatorFactory(): ServiceLocatorFactoryInterface
    {
        if (! $this->factory instanceof ServiceLocatorFactoryInterface) {
            $this->factory = new ServiceLocatorFactory();
        }

        return $this->factory ?: new ServiceLocatorFactory();
    }
788544
public function getRef($reference)
	{
		$ref = &self::_getArray();

		if (isset($ref[$reference]))
		{
			return $ref[$reference];
		}
		else
		{
			return false;
		}
	}
114750
public static function getReference() {
		if(self::$entity_manager == null)
			self::initialize();

		return call_user_func_array(array(self::$entity_manager, "getReference"), func_get_args());
	}
1037651
def retrieve(cls, *args, **kwargs):
        """"""
        return super(Subscription, cls).retrieve(*args, **kwargs)
231667
public function subscribers()
    {
        return $this->morphToMany(config('follow.user_model'), config('follow.morph_prefix'), config('follow.followable_table'))
                    ->wherePivot('relation', '=', Follow::RELATION_SUBSCRIBE)
                    ->withPivot('followable_type', 'relation', 'created_at');
    }
985157
public function getSubscription($id)
    {
        $url = $this->accountsEndpoint . 'subscriptions';
        return Subscription::get($id, $url, $this->connector->getClient());
    }
957173
public function updateSubscription($params = null)
    {
        $url = $this->instanceUrl() . '/subscription';
        list($response, $opts) = $this->_request('post', $url, $params);
        $this->refreshFrom(['subscription' => $response], $opts, true);
        return $this->subscription;
    }
215576
public function subscription($subscription = 'default')
    {
        return $this->subscriptions->sortByDesc(function ($value) {
            return $value->created_at->getTimestamp();
        })->first(function ($value) use ($subscription) {
            return $value->name === $subscription;
        });
    }
919605
public function getSubscriptionsCount()
    {
        $cache = Podium::getInstance()->podiumCache->getElement('user.subscriptions', $this->id);
        if ($cache === false) {
            $cache = (new Query)->from(Subscription::tableName())->where([
                    'user_id' => $this->id,
                    'post_seen' => Subscription::POST_NEW
                ])->count();
            Podium::getInstance()->podiumCache->setElement('user.subscriptions', $this->id, $cache);
        }
        return $cache;
    }
67436
public function update($subscriptions)
    {
        $this->initCollection();

        /** @var SubscriptionInterface $subscription */
        foreach ($subscriptions as $subscription) {
            $this->changeSubscription(
                $subscription,
                (bool)$subscription->getSubscriberStatus() === true ?
                    Subscriber::STATUS_SUBSCRIBED :
                    Subscriber::STATUS_UNSUBSCRIBED
            );
        }

        return $this->statusResponseFactory->create()
            ->setStatus('ok');
    }
716224
public function getSubscriptionById($subscriptionId)
    {
        $subscriptions = $this
            ->getSubscriptions(null, null, null, $subscriptionId)
            ->getResponse()
            ->getSubscriptions();

        return count($subscriptions) ? reset($subscriptions) : null;
    }
1291448
public function index()
    {
        $subscribers = Subscriber::paginate(Binput::get('per_page', 20));

        return $this->paginator($subscribers, Request::instance());
    }
1328221
public function getConsumerService()
    {
        if ($this->consumerService === null) {
            $this->consumerService = new ConsumerService(
                $this->getHeaderPartFactory(),
                $this->getMimeLiteralPartFactory()
            );
        }
        return $this->consumerService;
    }
746944
function _get_subscription( $license_id ) {
            if ( ! isset( $this->_storage->subscriptions ) ||
                 empty( $this->_storage->subscriptions )
            ) {
                return null;
            }

            foreach ( $this->_storage->subscriptions as $subscription ) {
                if ( $subscription->license_id == $license_id ) {
                    return $subscription;
                }
            }

            return null;
        }