<commit_before><?php
/**
 * @package plugins.interactivity
 * @subpackage model.items
 */

class kInteractivityNodeValidator extends kInteractivityBaseValidator
{
	const ID = 'id';
	const NAME = 'name';
	const ENTRY_ID = 'entryId';
	const OBJECT_NAME = 'node';
	const INTERACTIONS = 'interactions';

	protected $interactionValidator;

	/**
	 * kInteractivityBaseNodeValidator constructor.
	 * @param $entry
	 */
	public function __construct($entry)
	{
		parent::__construct($entry);
		$this->interactionValidator = new kInteractivityInteractionValidator($entry);
	}

	public function validate($data)
	{
		$this->validateMandatoryField($data, self::OBJECT_NAME, self::ID);
		$this->validateMandatoryField($data, self::OBJECT_NAME, self::NAME);
		$this->validateMandatoryField($data, self::OBJECT_NAME, self::ENTRY_ID);
		$this->validateMandatoryField($data, self::OBJECT_NAME, self::INTERACTIONS);

		foreach ($data[self::INTERACTIONS] as $interaction)
		{
			$this->interactionValidator->validate($interaction);
		}
	}
}<commit_msg>Propus-16.0.1-PLAT-10797-changing interactivity interaction to be not mandatory (#9337)<commit_after><?php
/**
 * @package plugins.interactivity
 * @subpackage model.items
 */

class kInteractivityNodeValidator extends kInteractivityBaseValidator
{
	const ID = 'id';
	const NAME = 'name';
	const ENTRY_ID = 'entryId';
	const OBJECT_NAME = 'node';
	const INTERACTIONS = 'interactions';

	protected $interactionValidator;

	/**
	 * kInteractivityBaseNodeValidator constructor.
	 * @param $entry
	 */
	public function __construct($entry)
	{
		parent::__construct($entry);
		$this->interactionValidator = new kInteractivityInteractionValidator($entry);
	}

	public function validate($data)
	{
		$this->validateMandatoryField($data, self::OBJECT_NAME, self::ID);
		$this->validateMandatoryField($data, self::OBJECT_NAME, self::NAME);
		$this->validateMandatoryField($data, self::OBJECT_NAME, self::ENTRY_ID);
		if(isset($data[self::INTERACTIONS]))
		{
			foreach ($data[self::INTERACTIONS] as $interaction)
			{
				$this->interactionValidator->validate($interaction);
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.14082503556187767, 'fraction_numerical': 0.006164058795637743, 'mean_word_length': 6.033333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '6963117', 'n_tokens_mistral': 706, 'n_tokens_neox': 653, 'n_words': 119}