<commit_before><?php

namespace ActiveCollab\Payments\Subscription\SubscriptionEvent;

use ActiveCollab\Payments\Gateway\GatewayInterface;
use ActiveCollab\Payments\Subscription\SubscriptionInterface;
use RuntimeException;

/**
 * @package ActiveCollab\Payments\Subscription\SubscriptionEvent
 */
trait Implementation
{
    /**
     * @var string
     */
    private $subscription_reference;

    /**
     * Return subscription reference (subscription ID)
     *
     * @return string
     */
    public function getSubscriptionReference()
    {
        return $this->subscription_reference;
    }

    /**
     * Return subscription by subscription reference
     *
     * @return SubscriptionInterface
     */
    public function getSubscription()
    {
        if ($this->getGateway() instanceof GatewayInterface) {
            return $this->getGateway()->getOrderByReference($this->getSubscriptionReference());
        }

        throw new RuntimeException('Gateway is not set');
    }

    /**<commit_msg>Return subscription by subscription reference<commit_after><?php

namespace ActiveCollab\Payments\Subscription\SubscriptionEvent;

use ActiveCollab\Payments\Gateway\GatewayInterface;
use ActiveCollab\Payments\Subscription\SubscriptionInterface;
use RuntimeException;

/**
 * @package ActiveCollab\Payments\Subscription\SubscriptionEvent
 */
trait Implementation
{
    /**
     * @var string
     */
    private $subscription_reference;

    /**
     * Return subscription reference (subscription ID)
     *
     * @return string
     */
    public function getSubscriptionReference()
    {
        return $this->subscription_reference;
    }

    /**
     * Return subscription by subscription reference
     *
     * @return SubscriptionInterface
     */
    public function getSubscription()
    {
        if ($this->getGateway() instanceof GatewayInterface) {
            return $this->getGateway()->getSubscriptionByReference($this->getSubscriptionReference());
        }

        throw new RuntimeException('Gateway is not set');
    }

    /**
{'fraction_non_alphanumeric': 0.09907722195240408, 'fraction_numerical': 0.0, 'mean_word_length': 3.1282565130260522, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6811525', 'n_tokens_mistral': 501, 'n_tokens_neox': 527, 'n_words': 106}