<commit_before><?php
/**
 * media_persistentdocument_file
 * @package modules.media
 */
class media_persistentdocument_file extends media_persistentdocument_filebase 
{
	private $info;
	
	private function loadInfoForLang($lang)
	{
		if (!isset($this->info[$lang]))
		{
			$infoData = parent::getInfoForLang($lang);
			if ($infoData == null)
			{
				$this->info[$lang] = array();
			}
			else
			{
				$this->info[$lang] = unserialize($infoData);
				$this->info[$lang]['id'] = $this->getId();
			}
		}
	}
	
	/**
	 * @return array
	 */	
	public function getCommonInfo()
	{
		$info = $this->getInfo();
		if (!$this->getFilename())
		{
			$info = array_merge($this->getInfoForLang($this->getLang()), $info);
		}
		return $info;
	}
	
	
	
	/**
	 * @return array
	 */
	public function getInfo()
	{
		return $this->getInfoForLang(RequestContext::getInstance()->getLang());
	}
	
	/**
	 * @param string $lang
	 * @return array
	 */
	public function getInfoForLang($lang)
	{
		$this->loadInfoForLang($lang);
		$infos = $this->info[$lang];		
		if (!isset($info['type']))
		{
			$info['type'] = MediaHelper::getMediaTypeByFilename($this->getFilename());
		}
		return $info;
	}	
		
	/**
	 * @param array $info
	 */
	public function setInfo($info)
	{
		if (!isset($info['type']))
		{
			$info['type'] = MediaHelper::getMediaTypeByFilename($this->getFilename());
		}
		$lang = RequestContext::getInstance()->getLang();
		$this->loadInfoForLang($lang);
		$this->info[$lang] = $info;<commit_msg>[FIX] infos loading.<commit_after><?php
/**
 * media_persistentdocument_file
 * @package modules.media
 */
class media_persistentdocument_file extends media_persistentdocument_filebase 
{
	private $info;
	
	/**
	 * @param string $lang
	 */
	private function loadInfoForLang($lang)
	{
		if (!isset($this->info[$lang]))
		{
			$infoData = parent::getInfoForLang($lang);
			if ($infoData == null)
			{
				$this->info[$lang] = array();
			}
			else
			{
				$this->info[$lang] = unserialize($infoData);
				$this->info[$lang]['id'] = $this->getId();
			}
		}
	}
	
	/**
	 * @return array
	 */	
	public function getCommonInfo()
	{
		$info = $this->getInfo();
		if (!$this->getFilename())
		{
			$info = array_merge($this->getInfoForLang($this->getLang()), $info);
		}
		return $info;
	}
	
	/**
	 * @return array
	 */
	public function getInfo()
	{
		return $this->getInfoForLang(RequestContext::getInstance()->getLang());
	}
	
	/**
	 * @param string $lang
	 * @return array
	 */
	public function getInfoForLang($lang)
	{
		$this->loadInfoForLang($lang);
		$infos = $this->info[$lang];		
		if (!isset($infos['type']))
		{
			$infos['type'] = MediaHelper::getMediaTypeByFilename($this->getFilename());
		}
		return $infos;
	}	
		
	/**
	 * @param array $info
	 */
	public function setInfo($info)
	{
		if (!isset($info['type']))
		{
			$info['type'] = MediaHelper::getMediaTypeByFilename($this->getFilename());
		}
		$lang = RequestContext::getInstance()->getLang();
		$this->loadInfoForLang($lang);
		$this->info[$lang] = $info;
{'fraction_non_alphanumeric': 0.19779853235490327, 'fraction_numerical': 0.0, 'mean_word_length': 3.8449111470113086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '4102600', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1034, 'n_words': 164}