@param Subscription $subscription

@return int
176876
protected function listProperties(Subscription $subscription)
    {
        $headings = [];
        $values = [];
        foreach ($subscription->getProperties() as $key => $value) {
            $headings[] = new AdaptiveTableCell($key, ['wrap' => false]);
            $values[] = $this->formatter->format($value, $key);
        }
        /** @var \Platformsh\Cli\Service\Table $table */
        $table = $this->getService('table');
        $table->renderSimple($values, $headings);

        return 0;
    }
1144404
public function getLastVersionNumber($con = null)
    {
        $v = ChildIndexEngineIndexVersionQuery::create()
            ->filterByIndexEngineIndex($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
214188
public function registerSubscriber(SubscriberInterface $subscriber)
    {
        $class = get_class($subscriber);
        $events = $subscriber->getEvents();

        foreach ($events as $event => $actions) {
            $this->registerEvent($event);
            $this->events[$event][$class] = $subscriber;
        }
    }
501654
public function subscribed($subscriber)
    {
        if ($subscriber->id && $this->subscriberIds->offsetExists($subscriber->id)) {
            return true;
        }

        return false;
    }
225189
public static void removeSubscription(Subscription subscription) {
        mSubscriptions.remove(subscription);
        LiveQueryClient.executeQuery(subscription.getQuery().unsubscribeQueryToString());
    }
96930
public function isSubscription()
    {
        $started = $this->subscriptionStarted();
        $status = $this->status();
        $time = time();

        if ($started !== '' && is_numeric($started) && $status !== '' && $status !== 'canceled' && $time < $this->subscriptionEndsAt()) {
            return true;
        } else {
            return false;
        }
    }
1027140
public function synchronise(Subscription $subscription)
    {
        try {
            $contact = [
                'update' => true,
                'purge' => false,
                'contact' => [
                    'externalId' => $subscription->getId(),
                    'properties' => [
                        'email' => $subscription->getEmail(),
                    ],
                ],
            ];

            $response = $this->post('contact', $contact);

            if ($response->getStatusCode() == '204') { //Contact added successfully status code
                $this->subscriptionManager->updateStatus($subscription, Subscription::STATUS_SYNCED);

                return true;
            } else {
                $this->subscriptionManager->updateStatus($subscription, Subscription::STATUS_FAILED);

                return false;
            }
        } catch (\Exception $e) {
            $this->subscriptionManager->updateStatus($subscription, Subscription::STATUS_FAILED);

            return true;
        }
    }
2361
public function getSubscriptionByExtUid($subscriptionExtUid)
    {
        /** @var SubscriptionFbApi $response */
        $response = $this->call(new Request('subscription.get', array('subscription_ext_uid' => $subscriptionExtUid)), 'DVelopment\FastBill\Model\SubscriptionFbApi');
        $subscriptions = $response->getResponse()->getSubscriptions();

        return reset($subscriptions);
    }
682922
public function getLastVersionNumber($con = null)
    {
        $v = ChildSkillVersionQuery::create()
            ->filterBySkill($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
910022
protected function execute(InputInterface $input, OutputInterface $output): ?int
    {
        $username = $this->getUsername($input, $output);
        $user = $this->findUser($output, $username);
        if (null === $user) {
            return 1;
        }

        $password = $this->getPassword($input, $output);
        if ($password) {
            $this->userManager->setPlainTextPassword($user, $password);
        } else {
            $this->userManager->requestNewPassword($user);
        }
        $this->userManager->save($user);

        if ($password) {
            $message = $this->translator->trans(
                'user.password_changed_success',
                ['%username%' => $username],
                'security'
            );
        } else {
            $message = $this->translator->trans(
                'user.password_request_sent',
                ['%username%' => $username],
                'security'
            );
        }
        $output->writeln("<info>{$message}</info>");

        return 0;
    }
1313234
public function publish(string $message): int
    {
        return $this->handle->publish($this->name, $message);
    }
322759
public function onTrial($subscription = 'default', $plan = null)
    {
        if (func_num_args() === 0 && $this->onGenericTrial()) {
            return true;
        }

        $subscription = $this->subscription($subscription);

        if (is_null($plan)) {
            return $subscription && $subscription->onTrial();
        }

        return $subscription && $subscription->onTrial() &&
               $subscription->stripe_plan === $plan;
    }
440825
public function removeSubscriber(SubscriberInterface $instance) {

		// check for object hash

		if(FALSE !== ($pos = array_search(spl_object_hash($instance), $this->registeredHashes))) {
		
			// remove instance from registry before re-inserting
			
			unset($this->registeredHashes[$pos]);

			foreach($instance::getEventsToSubscribe() as $eventName => $parameters) {
			
				$methodName	= array_shift($parameters);
				$callable = array($instance, $methodName);
			
				foreach($this->registry[$eventName] as $priority => $subscribers) {
						
					if (false !== ($pos = array_search($callable, $subscribers, TRUE))) {
						unset(
							$this->registry[$eventName][$priority][$pos],
							$this->sortedRegistry[$eventName]
						);
					}

				}
			}
		}
	}
1021821
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;
    }
623136
public static function filterAndSortSubscriptionListForDisplay(array $subscriptions)
    {
        $filteredList = self::filterSubscriptionListForDisplay($subscriptions);
        $filteredAndSortedList = self::sortSubscriptionListForDisplay($filteredList);

        return $filteredAndSortedList;
    }
975882
def has_in_subscriptions(self, subscription):
        
        assert isinstance(subscription, github.Repository.Repository), subscription
        status, headers, data = self._requester.requestJson(
            "GET",
            "/user/subscriptions/" + subscription._identity
        )
        return status == 204
119593
public function total()
    {
        $response = $this->send(sprintf('subscribers_count/?api_token=%s', $this->apiToken));
        $content  = json_decode($response->getBody());

        return (integer) $content->count;
    }