<commit_before><?php

namespace Fazland\SkebbyRestClient\DataStructure;
use Fazland\SkebbyRestClient\Constant\ValidityPeriods;
use Fazland\SkebbyRestClient\Exception\InvalidDeliveryStartException;
use Fazland\SkebbyRestClient\Exception\InvalidValidityPeriodException;

/**
 * @author <NAME> <<EMAIL>>
 */
class Sms
{
    /**
     * @var string[]
     */
    private $recipients;

    /**
     * @var string[][]
     */
    private $recipientVariables;

    /**
     * @var string
     */
    private $text;

    /**
     * @var string
     */
    private $userReference;

    /**
     * @var \DateTime
     */
    private $deliveryStart;

    /**
     * @var \DateInterval
     */
    private $validityPeriod;

    /**
     * Sms constructor.
     */
    public function __construct()
    {
        $this->recipients = [];
        $this->recipientVariables = [];
    }

    /**
     * @return static
     */
    public static function create()
    {
        return new static();
    }

    /**
     * @return string[]
     */
    public function getRecipients()
    {
        return $this->recipients;
    }

    /**
     * @param string[] $recipients
     *
     * @return $this
     */
    public function setRecipients(array $recipients)
    {
        $this->recipients = $recipients;

        return $this;
    }

    /**
     * @param string $recipient
     *
     * @return $this
     */
    public function addRecipient($recipient)
    {
        $this->recipients[] = $recipient;

        return $this;
    }

    /**
     * @param string $recipient
     *
     * @return $this
     */
    public function removeRecipient($recipient)
    {
        $itemPosition = array_search($recipient, $this->recipients);

        if (false !== $itemPosition) {
            unset($this->recipients[$itemPosition]);
        }

        unset($this->recipientVariables[$recipient]);

        return $this;
    }

    /**
     * @return bool
     */
    public function hasRecipients()
    {
        return ! empty($this->recipients);
    }

    /**
     * @return string[][]
     */
    public function getRecipientVariables()
    {
        return $this->recipientVariables;
    }

    /**
     * @param string $recipient
     * @param string[] $recipientVariables
     *
     * @return $this
     */
    public function setRecipientVariables($recipient, array $recipientVariables)
    {
        $this->recipientVariables[$recipient] = $recipientVariables;

        return $this;
    }

    /**
     * @param string $recipient
     * @param string $recipientVariable
     * @param string $recipientVariableValue
     *
     * @return $this
     */
    public function addRecipientVariable($recipient, $recipientVariable, $recipientVariableValue)
    {
        if (! isset($this->recipientVariables[$recipient])) {
            $this->recipientVariables[$recipient] = [];
        }

        $this->recipientVariables[$recipient][$recipientVariable] = $recipientVariableValue;

        return $this;
    }

    /**
     * @param string $recipient
     * @param string $recipientVariable
     *
     * @return $this
     */
    public function removeRecipientVariable($recipient, $recipientVariable)
    {
        unset($this->recipientVariables[$recipient][$recipientVariable]);

        return $this;
    }

    /**
     * @return bool
     */
    public function hasRecipientVariables()
    {
        return ! empty($this->recipientVariables);
    }

    /**
     * @return $this
     */
    public function clearRecipientVariables()
    {
        $this->recipientVariables = [];

        return $this;
    }

    /**
     * @return string
     */
    public function getText()
    {
        return $this->text;
    }

    /**
     * @param string $text
     *
     * @return $this
     */
    public function setText($text)
    {
        $this->text = $text;

        return $this;
    }

    /**
     * @return string
     */
    public function getUserReference()
    {
        return $this->userReference;
    }

    /**
     * @param string $userReference
     *
     * @return $this
     */
    public function setUserReference($userReference)
    {
        $this->userReference = $userReference;

        return $this;
    }

    /**
     * @return \DateTime
     */
    public function getDeliveryStart()
    {
        return $this->deliveryStart;
    }

    /**
     * @param \DateTime|null $deliveryStart
     *
     * @return $this
     *
     * @throws InvalidDeliveryStartException
     */
    public function setDeliveryStart(\DateTime $deliveryStart = null)
    {
        if (null !== $deliveryStart && $deliveryStart < date_create_from_format('U', time())) {
            throw new InvalidDeliveryStartException();
        }

        $this->deliveryStart = $deliveryStart;

        return $this;
    }

    /**
     * @return \DateInterval
     */
    public function getValidityPeriod()
    {
        return $this->validityPeriod;
    }

    /**
     * @param \DateInterval|null $validityPeriod
     *
     * @return $this
     *
     * @throws InvalidValidityPeriodException
     */
    public function setValidityPeriod(\DateInterval $validityPeriod = null)
    {
        if (null !== $validityPeriod &&
            ($validityPeriod->i < ValidityPeriods::MIN || $validityPeriod->i > ValidityPeriods::MAX)
        ) {
            throw new InvalidValidityPeriodException();
        }<commit_msg>hhvm compatibility<commit_after><?php

namespace Fazland\SkebbyRestClient\DataStructure;
use Fazland\SkebbyRestClient\Constant\ValidityPeriods;
use Fazland\SkebbyRestClient\Exception\InvalidDeliveryStartException;
use Fazland\SkebbyRestClient\Exception\InvalidValidityPeriodException;

/**
 * @author <NAME> <<EMAIL>>
 */
class Sms
{
    /**
     * @var string[]
     */
    private $recipients;

    /**
     * @var string[][]
     */
    private $recipientVariables;

    /**
     * @var string
     */
    private $text;

    /**
     * @var string
     */
    private $userReference;

    /**
     * @var \DateTime
     */
    private $deliveryStart;

    /**
     * @var \DateInterval
     */
    private $validityPeriod;

    /**
     * Sms constructor.
     */
    public function __construct()
    {
        $this->recipients = [];
        $this->recipientVariables = [];
    }

    /**
     * @return static
     */
    public static function create()
    {
        return new static();
    }

    /**
     * @return string[]
     */
    public function getRecipients()
    {
        return $this->recipients;
    }

    /**
     * @param string[] $recipients
     *
     * @return $this
     */
    public function setRecipients(array $recipients)
    {
        $this->recipients = $recipients;

        return $this;
    }

    /**
     * @param string $recipient
     *
     * @return $this
     */
    public function addRecipient($recipient)
    {
        $this->recipients[] = $recipient;

        return $this;
    }

    /**
     * @param string $recipient
     *
     * @return $this
     */
    public function removeRecipient($recipient)
    {
        $itemPosition = array_search($recipient, $this->recipients);

        if (false !== $itemPosition) {
            unset($this->recipients[$itemPosition]);
        }

        unset($this->recipientVariables[$recipient]);

        return $this;
    }

    /**
     * @return bool
     */
    public function hasRecipients()
    {
        return ! empty($this->recipients);
    }

    /**
     * @return string[][]
     */
    public function getRecipientVariables()
    {
        return $this->recipientVariables;
    }

    /**
     * @param string $recipient
     * @param string[] $recipientVariables
     *
     * @return $this
     */
    public function setRecipientVariables($recipient, array $recipientVariables)
    {
        $this->recipientVariables[$recipient] = $recipientVariables;

        return $this;
    }

    /**
     * @param string $recipient
     * @param string $recipientVariable
     * @param string $recipientVariableValue
     *
     * @return $this
     */
    public function addRecipientVariable($recipient, $recipientVariable, $recipientVariableValue)
    {
        if (! isset($this->recipientVariables[$recipient])) {
            $this->recipientVariables[$recipient] = [];
        }

        $this->recipientVariables[$recipient][$recipientVariable] = $recipientVariableValue;

        return $this;
    }

    /**
     * @param string $recipient
     * @param string $recipientVariable
     *
     * @return $this
     */
    public function removeRecipientVariable($recipient, $recipientVariable)
    {
        unset($this->recipientVariables[$recipient][$recipientVariable]);

        return $this;
    }

    /**
     * @return bool
     */
    public function hasRecipientVariables()
    {
        return ! empty($this->recipientVariables);
    }

    /**
     * @return $this
     */
    public function clearRecipientVariables()
    {
        $this->recipientVariables = [];

        return $this;
    }

    /**
     * @return string
     */
    public function getText()
    {
        return $this->text;
    }

    /**
     * @param string $text
     *
     * @return $this
     */
    public function setText($text)
    {
        $this->text = $text;

        return $this;
    }

    /**
     * @return string
     */
    public function getUserReference()
    {
        return $this->userReference;
    }

    /**
     * @param string $userReference
     *
     * @return $this
     */
    public function setUserReference($userReference)
    {
        $this->userReference = $userReference;

        return $this;
    }

    /**
     * @return \DateTime
     */
    public function getDeliveryStart()
    {
        return $this->deliveryStart;
    }

    /**
     * @param \DateTime|null $deliveryStart
     *
     * @return $this
     *
     * @throws InvalidDeliveryStartException
     */
    public function setDeliveryStart(\DateTime $deliveryStart = null)
    {
        if (null !== $deliveryStart && $deliveryStart < date_create_from_format('U', (string)time())) {
            throw new InvalidDeliveryStartException();
        }

        $this->deliveryStart = $deliveryStart;

        return $this;
    }

    /**
     * @return \DateInterval
     */
    public function getValidityPeriod()
    {
        return $this->validityPeriod;
    }

    /**
     * @param \DateInterval|null $validityPeriod
     *
     * @return $this
     *
     * @throws InvalidValidityPeriodException
     */
    public function setValidityPeriod(\DateInterval $validityPeriod = null)
    {
        if (null !== $validityPeriod &&
            ($validityPeriod->i < ValidityPeriods::MIN || $validityPeriod->i > ValidityPeriods::MAX)
        ) {
            throw new InvalidValidityPeriodException();
        }
{'fraction_non_alphanumeric': 0.12776185633724693, 'fraction_numerical': 0.0, 'mean_word_length': 1.9983370288248337, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 63, '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': '4593591', 'n_tokens_mistral': 3304, 'n_tokens_neox': 3106, 'n_words': 575}