<commit_before><?php
/**
 * @package Scheduler
 * @subpackage Conversion
 */
class KOperationManager
{
	/**
	 * @param int $type
	 * @param KSchedularTaskConfig $taskConfig
	 * @param KalturaConvartableJobData $data
	 * @param KalturaClient $client
	 * @return KOperationEngine
	 */
	public static function getEngine($type, KSchedularTaskConfig $taskConfig, KalturaConvartableJobData $data, KalturaClient $client)
	{
		$engine = self::createNewEngine($type, $taskConfig, $data);
		if(!$engine)
			return null;
			
		$engine->configure($taskConfig, $data, $client);
		return $engine;
	}
	
	/**
	 * @param int $type
	 * @param KSchedularTaskConfig $taskConfig
	 * @param KalturaConvartableJobData $data
	 * @return KOperationEngine
	 */
	protected static function createNewEngine($type, KSchedularTaskConfig $taskConfig, KalturaConvartableJobData $data)
	{
		// TODO - remove after old version deprecated
		if(!$data->flavorParamsOutput->engineVersion)
		{
			return new KOperationEngineOldVersionWrapper($type, $taskConfig, $data);
		}
		
		switch($type)
		{
			case KalturaConversionEngineType::MENCODER:
				return new KOperationEngineMencoder($taskConfig->params->mencderCmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::ON2:
				return new KOperationEngineFlix($taskConfig->params->on2Cmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::FFMPEG:
				return new KOperationEngineFfmpeg($taskConfig->params->ffmpegCmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::FFMPEG_AUX:
				return new KOperationEngineFfmpegAux($taskConfig->params->ffmpegAuxCmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::FFMPEG_VP8:
				return new KOperationEngineFfmpegVp8($taskConfig->params->ffmpegVp8Cmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::ENCODING_COM :
				return new KOperationEngineEncodingCom(
					$taskConfig->params->EncodingComUserId, 
					$taskConfig->params->EncodingComUserKey, <commit_msg>fwr: SL/ISM related fixes - missing floveParmsOutput for collections <commit_after><?php
/**
 * @package Scheduler
 * @subpackage Conversion
 */
class KOperationManager
{
	/**
	 * @param int $type
	 * @param KSchedularTaskConfig $taskConfig
	 * @param KalturaConvartableJobData $data
	 * @param KalturaClient $client
	 * @return KOperationEngine
	 */
	public static function getEngine($type, KSchedularTaskConfig $taskConfig, KalturaConvartableJobData $data, KalturaClient $client)
	{
		$engine = self::createNewEngine($type, $taskConfig, $data);
		if(!$engine)
			return null;
			
		$engine->configure($taskConfig, $data, $client);
		return $engine;
	}
	
	/**
	 * @param int $type
	 * @param KSchedularTaskConfig $taskConfig
	 * @param KalturaConvartableJobData $data
	 * @return KOperationEngine
	 */
	protected static function createNewEngine($type, KSchedularTaskConfig $taskConfig, KalturaConvartableJobData $data)
	{
		// TODO - remove after old version deprecated
		/*
		 * The 'flavorParamsOutput' is not set only for SL/ISM collections - that is definently old engine' flow
		 */
		if(!isset($data->flavorParamsOutput) || !$data->flavorParamsOutput->engineVersion)
		{
			return new KOperationEngineOldVersionWrapper($type, $taskConfig, $data);
		}
		
		switch($type)
		{
			case KalturaConversionEngineType::MENCODER:
				return new KOperationEngineMencoder($taskConfig->params->mencderCmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::ON2:
				return new KOperationEngineFlix($taskConfig->params->on2Cmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::FFMPEG:
				return new KOperationEngineFfmpeg($taskConfig->params->ffmpegCmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::FFMPEG_AUX:
				return new KOperationEngineFfmpegAux($taskConfig->params->ffmpegAuxCmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::FFMPEG_VP8:
				return new KOperationEngineFfmpegVp8($taskConfig->params->ffmpegVp8Cmd, $data->destFileSyncLocalPath);
				
			case KalturaConversionEngineType::ENCODING_COM :
				return new KOperationEngineEncodingCom(
					$taskConfig->params->EncodingComUserId, 
					$taskConfig->params->EncodingComUserKey, 
{'fraction_non_alphanumeric': 0.10559587918520252, 'fraction_numerical': 0.0023413720440177946, 'mean_word_length': 5.300884955752212, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, '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': '6612581', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1302, 'n_words': 248}