<commit_before><?php
/**
 * @package modules.media
 */
class media_SecuremediaService extends media_MediaService
{
	/**
	 * @var media_SecuremediaService
	 */
	private static $instance;

	/**
	 * @return media_SecuremediaService
	 */
	public static function getInstance()
	{
		if (self::$instance === null)
		{
			self::$instance = self::getServiceClassInstance(get_class());
		}
		return self::$instance;
	}

	/**
	 * @return media_persistentdocument_securemedia
	 */
	public function getNewDocumentInstance()
	{
		return $this->getNewDocumentInstanceByModelName('modules_media/securemedia');
	}

	/**
	 * @param Integer $id
	 * @param String $lang
	 * @return String
	 */
	protected function getAbsoluteFolder($id, $lang = null)
	{
		return WEBEDIT_HOME.'/securemedia/original/'.$this->getRelativeFolder($id, $lang);
	}

	/**
	 * @param Integer $id
	 * @param String $lang
	 * @return String
	 */
	protected function getFormattedAbsoluteFolder($id, $lang = null)
	{
		return WEBEDIT_HOME.'/securemedia/formatted/'.$this->getRelativeFolder($id, $lang);
	}

	/**
	 * @param media_persistentdocument_securemedia $document
	 * @param string $lang
	 * @param array $parameters
	 */
	public function generateUrl($document, $lang, $parameters)
	{
		return $this->generateDownloadUrl($document, $lang, $parameters);
	}

	/**
	 * Compute access using the registered strategies.
	 * @param media_persistentdocument_securemedia $media
	 * @return Boolean
	 */
	public function hasAccess($media)
	{
		foreach ($this->getStrategyArray() as $strategy)
		{
			switch ($strategy->canDisplayMedia($media))
			{
				case media_DisplaySecuremediaStrategy::OK:
					return true;
				case media_DisplaySecuremediaStrategy::KO:
					return false;
				case media_DisplaySecuremediaStrategy::NOT_CONCERNED:<commit_msg>[FIX] Set default values for generateUrl method, like in other documents.<commit_after><?php
/**
 * @package modules.media
 */
class media_SecuremediaService extends media_MediaService
{
	/**
	 * @var media_SecuremediaService
	 */
	private static $instance;

	/**
	 * @return media_SecuremediaService
	 */
	public static function getInstance()
	{
		if (self::$instance === null)
		{
			self::$instance = self::getServiceClassInstance(get_class());
		}
		return self::$instance;
	}

	/**
	 * @return media_persistentdocument_securemedia
	 */
	public function getNewDocumentInstance()
	{
		return $this->getNewDocumentInstanceByModelName('modules_media/securemedia');
	}

	/**
	 * @param Integer $id
	 * @param String $lang
	 * @return String
	 */
	protected function getAbsoluteFolder($id, $lang = null)
	{
		return WEBEDIT_HOME.'/securemedia/original/'.$this->getRelativeFolder($id, $lang);
	}

	/**
	 * @param Integer $id
	 * @param String $lang
	 * @return String
	 */
	protected function getFormattedAbsoluteFolder($id, $lang = null)
	{
		return WEBEDIT_HOME.'/securemedia/formatted/'.$this->getRelativeFolder($id, $lang);
	}

	/**
	 * @param media_persistentdocument_securemedia $document
	 * @param string $lang
	 * @param array $parameters
	 */
	public function generateUrl($document, $lang = null, $parameters = array())
	{
		return $this->generateDownloadUrl($document, $lang, $parameters);
	}

	/**
	 * Compute access using the registered strategies.
	 * @param media_persistentdocument_securemedia $media
	 * @return Boolean
	 */
	public function hasAccess($media)
	{
		foreach ($this->getStrategyArray() as $strategy)
		{
			switch ($strategy->canDisplayMedia($media))
			{
				case media_DisplaySecuremediaStrategy::OK:
					return true;
				case media_DisplaySecuremediaStrategy::KO:
					return false;
				case media_DisplaySecuremediaStrategy::NOT_CONCERNED:
{'fraction_non_alphanumeric': 0.12864540746797493, 'fraction_numerical': 0.0, 'mean_word_length': 4.494011976047904, 'pattern_counts': {'":': 0, '<': 5, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5616715', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1091, 'n_words': 235}