<commit_before><?php
/**
 * This file is part of the PHP Rebilly API package.
 *
 * (c) 2015 Rebilly SRL
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */

namespace Rebilly\Entities;

/**
 * Class SubscriptionSwitch
 *
 * @author <NAME> <<EMAIL>>
 * @version 0.1
 */
final class SubscriptionSwitch extends SubscriptionCancel
{
    /**
     * @return string
     */
    public function getPlanId()
    {
        return $this->getAttribute('plan');
    }

    /**
     * @param string $value
     *
     * @return SubscriptionSwitch
     */
    public function setPlanId($value)
    {
        return $this->setAttribute('plan', $value);
    }<commit_msg>Add policy setter and getter to SubscriptionSwitch entity (#202)<commit_after><?php
/**
 * This file is part of the PHP Rebilly API package.
 *
 * (c) 2015 Rebilly SRL
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */

namespace Rebilly\Entities;

use DomainException;

/**
 * Class SubscriptionSwitch
 *
 * @author <NAME> <<EMAIL>>
 * @version 0.1
 */
final class SubscriptionSwitch extends SubscriptionCancel
{
    const AT_NEXT_RENEWAL = 'at-next-renewal';
    const NOW = 'now';
    const NOW_WITH_PRORATA_CREDIT = 'now-with-prorata-credit';

    /**
     * @return array
     */
    public static function policies()
    {
        return [
            self::AT_NEXT_RENEWAL,
            self::NOW,
            self::NOW_WITH_PRORATA_CREDIT,
        ];
    }

    /**
     * @return string
     */
    public function getPolicy()
    {
        return $this->getAttribute('policy');
    }

    /**
     * @param string $value
     *
     * @throws DomainException
     *
     * @return SubscriptionCancel
     */
    public function setPolicy($value)
    {
        if (!in_array($value, self::policies())) {
            throw new DomainException(sprintf(self::MSG_UNEXPECTED_POLICY, implode(', ', self::policies())));
        }

        return $this->setAttribute('policy', $value);
    }

    /**
     * @return string
     */
    public function getPlanId()
    {
        return $this->getAttribute('plan');
    }

    /**
     * @param string $value
     *
     * @return SubscriptionSwitch
     */
    public function setPlanId($value)
    {
        return $this->setAttribute('plan', $value);
    }
{'fraction_non_alphanumeric': 0.12289354706124127, 'fraction_numerical': 0.006165228113440197, 'mean_word_length': 2.428169014084507, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '1348141', 'n_tokens_mistral': 736, 'n_tokens_neox': 724, 'n_words': 189}