<commit_before><?php
/**
 * kEntitlementUtils is all utils needed for entitlement use cases.
 * @package Core
 * @subpackage utils
 *
 */
class kEntitlementUtils
{
	const DEFAULT_CONTEXT = 'DEFAULTPC';
	const NOT_DEFAULT_CONTEXT = 'NOTDEFAULTPC';
	const TYPE_SEPERATOR = "TYPE";
	const ENTRY_PRIVACY_CONTEXT = 'ENTRYPC';
	const PARTNER_ID_PREFIX = 'pid';

	protected static $initialized = false;
	protected static $entitlementEnforcement = false;
	protected static $entitlementForced = null;
	protected static $privacyContextSearch = null;
	protected static $categoryModeration = false;

	public static function getDefaultContextString( $partnerId )
	{
		return self::getPartnerPrefix($partnerId) . self::DEFAULT_CONTEXT;
	}

	public static function getPartnerPrefix($partnerId)
	{
		return kEntitlementUtils::PARTNER_ID_PREFIX . $partnerId;
	}

	public static function addPrivacyContextsPrefix($privacyContextsArray, $partnerId )
	{
		if ( is_null($privacyContextsArray) || is_null($partnerId))
		{
			KalturaLog::err("can't handle privacy context for privacyContextsArray: $privacyContextsArray and partnerId: $partnerId.");
			return $privacyContextsArray;
		}
		$prefix = self::getPartnerPrefix($partnerId);

		foreach ($privacyContextsArray as &$value)
		{
			if (0 === strpos($value, $prefix))
				KalturaLog::err("handling Privacy context: $value already has a prefix of $prefix");
			else
				$value = $prefix . $value;
		}

		return $privacyContextsArray;
<commit_msg>Update kEntitlementUtils.php<commit_after><?php
/**
 * kEntitlementUtils is all utils needed for entitlement use cases.
 * @package Core
 * @subpackage utils
 *
 */
class kEntitlementUtils
{
	const DEFAULT_CONTEXT = 'DEFAULTPC';
	const NOT_DEFAULT_CONTEXT = 'NOTDEFAULTPC';
	const TYPE_SEPERATOR = "TYPE";
	const ENTRY_PRIVACY_CONTEXT = 'ENTRYPC';
	const PARTNER_ID_PREFIX = 'pid';

	protected static $initialized = false;
	protected static $entitlementEnforcement = false;
	protected static $entitlementForced = null;
	protected static $privacyContextSearch = null;
	protected static $categoryModeration = false;

	public static function getDefaultContextString( $partnerId )
	{
		return self::getPartnerPrefix($partnerId) . self::DEFAULT_CONTEXT;
	}

	public static function getPartnerPrefix($partnerId)
	{
		return kEntitlementUtils::PARTNER_ID_PREFIX . $partnerId;
	}

	public static function addPrivacyContextsPrefix($privacyContextsArray, $partnerId )
	{
		if ( is_null($privacyContextsArray) || is_null($partnerId))
		{
			KalturaLog::err("can't handle privacy context for privacyContextsArray: $privacyContextsArray and partnerId: $partnerId.");
			return $privacyContextsArray;
		}
		$prefix = self::getPartnerPrefix($partnerId);

		foreach ($privacyContextsArray as &$value)
		{
			$value = $prefix . $value;
		}

		return $privacyContextsArray;

{'fraction_non_alphanumeric': 0.1013060360042358, 'fraction_numerical': 0.00035298270384751147, 'mean_word_length': 5.683962264150943, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7310472', 'n_tokens_mistral': 943, 'n_tokens_neox': 895, 'n_words': 210}