<commit_before><?php



/**
 * Skeleton subclass for representing a row from the 'product' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.datawrapper
 */
class Product extends BaseProduct
{
	public function hasPlugin(Plugin $plugin) {
		return ProductPluginQuery::create()
			->filterByProduct($this)
			->filterByPlugin($plugin)
			->count() > 0;
	}

    public function getData() {
        $data = parent::getData();
        if(is_string($data)) {
            $data = json_decode($data, true);
        }

        return $data;
    }
}
<commit_msg>make it easier to write robust code against the product periods<commit_after><?php



/**
 * Skeleton subclass for representing a row from the 'product' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.datawrapper
 */
class Product extends BaseProduct
{
    const PERIOD_ONCE   = 'once';
    const PERIOD_DAYS   = 'day';
    const PERIOD_MONTHS = 'month';
    const PERIOD_YEARS  = 'year';

    public static $PERIODS = array(
        self::PERIOD_ONCE,
        self::PERIOD_DAYS,
        self::PERIOD_MONTHS,
        self::PERIOD_YEARS
    );

	public function hasPlugin(Plugin $plugin) {
		return ProductPluginQuery::create()
			->filterByProduct($this)
			->filterByPlugin($plugin)
			->count() > 0;
	}

    public function getData() {
        $data = parent::getData();
        if(is_string($data)) {
            $data = json_decode($data, true);
        }

        return $data;
    }

    public function isSubscription() {
        $data = $this->getData();
        return isset($data['period']) && $data['period'] !== self::PERIOD_ONCE;
    }
}

{'fraction_non_alphanumeric': 0.11351079859367152, 'fraction_numerical': 0.0010045203415369162, 'mean_word_length': 2.9058823529411764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '6072715', 'n_tokens_mistral': 613, 'n_tokens_neox': 586, 'n_words': 177}