<commit_before><?php
/**
 * @package api
 * @subpackage filters
 */
class KalturaFilter extends KalturaObject
{
	const LT = "lt";
	const LTE = "lte";
	const GT = "gt";
	const GTE = "gte";
	const EQ = "eq";
	const LIKE = "like";
	const XLIKE = "xlike";
	const LIKEX = "likex";
	const IN = "in";
	const NOT_IN = "notin";
	const NOT = "not";
	const BIT_AND = "bitand";
	const BIT_OR = "bitor";
	const MULTI_LIKE_OR = "mlikeor";
	const MULTI_LIKE_AND = "mlikeand";
	const MATCH_OR = "matchor";
	const MATCH_AND = "matchand";

	private $operator_map = array ( 
		);
	
	protected function getMapBetweenObjects ( )
	{
		return array_merge(parent::getMapBetweenObjects(), array("orderBy" => "_order_by"));
	}
	
	protected function getOrderByMap ( )
	{
		return array();
	}
	
	/**
	 * @var string $orderBy
	 */
	public $orderBy;
	
	/**
	 * @var KalturaSearchItem
	 */
	public $advancedSearch;
	
	// not supposed to be populated from core objects
/*		
	protected function fromObject ( $source_object  )
	{
		foreach ( $this->getMapBetweenObjects() as $this_prop => $object_prop )
		{
//	echo "Mapping $this_prop => $entry_prop<br>";
			if ( is_numeric( $this_prop) ) $this_prop = $object_prop;
//	echo "setting  $this_prop => $entry_prop<br>";
			$this->$this_prop = call_user_func(array ( $source_object ,"get{$object_prop}"  ) );
		}
	}
*/
	// must fill an object of type baseObjectFilter
	public function toObject ( $object_to_fill = null, $props_to_skip = array() )
	{
	    // translate the order by properties
	    $newOrderBy = "";
	    $orderByMap = $this->getOrderByMap();
	    if ($orderByMap)
		{
		    $orderProps = explode(",", $this->orderBy);
		    foreach($orderProps as $prop)
		    {
		         if (isset($orderByMap[$prop]))
		         {
		             $newOrderBy .= ($orderByMap[$prop] . ","); 
		         }
		    }
		}
		if (strpos($newOrderBy,",") === strlen($newOrderBy) - 1)
		    $newOrderBy = substr($newOrderBy, 0, strlen($newOrderBy) - 1);
		
		$this->orderBy = $newOrderBy;
		
		$typeReflector = KalturaTypeReflectorCacher::get(get_class($this));
		
		foreach ( $this->getMapBetweenObjects() as $this_prop => $object_prop )
		{
		 	if ( is_numeric( $this_prop) ) 
		 		$this_prop = $object_prop;
		 		
			$value = $this->$this_prop;
			$propertyInfo = $typeReflector->getProperty($this_prop);
			if($propertyInfo->isDynamicEnum())
			{
				$value = $this->toDynamicEnumValue($propertyInfo->getType(), $value);
			}
			elseif($propertyInfo->getDynamicType())
			{
				$values = explode(',', $value);
				$finalValues = array();
				foreach($values as $val)
					$finalValues[] = $this->toDynamicEnumValue($propertyInfo->getDynamicType(), $val);
				$value = implode(',', $finalValues);
			}
			
		 	// convert the v3 prop name to the naming convension of the core filter
		 	$filter_prop_name = self::translatePropNames ( $object_prop );
		 	$object_to_fill->set($filter_prop_name, $value);
		 }		
		 		
		if(is_object($this->advancedSearch) && $this->advancedSearch instanceof KalturaSearchItem)
		{
//			KalturaLog::debug("Advanced Search [" . print_r($this->advancedSearch, true) . "]");
			$object_to_fill->setAdvancedSearch($this->advancedSearch->toObject());
		}
			
		return $object_to_fill;		
	}	
	
	public function fromObject ( $source_object )
	{
		$reflector = KalturaTypeReflectorCacher::get(get_class($this));
		<commit_msg>set Advanced Search only if not null<commit_after><?php
/**
 * @package api
 * @subpackage filters
 */
class KalturaFilter extends KalturaObject
{
	const LT = "lt";
	const LTE = "lte";
	const GT = "gt";
	const GTE = "gte";
	const EQ = "eq";
	const LIKE = "like";
	const XLIKE = "xlike";
	const LIKEX = "likex";
	const IN = "in";
	const NOT_IN = "notin";
	const NOT = "not";
	const BIT_AND = "bitand";
	const BIT_OR = "bitor";
	const MULTI_LIKE_OR = "mlikeor";
	const MULTI_LIKE_AND = "mlikeand";
	const MATCH_OR = "matchor";
	const MATCH_AND = "matchand";

	private $operator_map = array ( 
		);
	
	protected function getMapBetweenObjects ( )
	{
		return array_merge(parent::getMapBetweenObjects(), array("orderBy" => "_order_by"));
	}
	
	protected function getOrderByMap ( )
	{
		return array();
	}
	
	/**
	 * @var string $orderBy
	 */
	public $orderBy;
	
	/**
	 * @var KalturaSearchItem
	 */
	public $advancedSearch;
	
	// not supposed to be populated from core objects
/*		
	protected function fromObject ( $source_object  )
	{
		foreach ( $this->getMapBetweenObjects() as $this_prop => $object_prop )
		{
//	echo "Mapping $this_prop => $entry_prop<br>";
			if ( is_numeric( $this_prop) ) $this_prop = $object_prop;
//	echo "setting  $this_prop => $entry_prop<br>";
			$this->$this_prop = call_user_func(array ( $source_object ,"get{$object_prop}"  ) );
		}
	}
*/
	// must fill an object of type baseObjectFilter
	public function toObject ( $object_to_fill = null, $props_to_skip = array() )
	{
	    // translate the order by properties
	    $newOrderBy = "";
	    $orderByMap = $this->getOrderByMap();
	    if ($orderByMap)
		{
		    $orderProps = explode(",", $this->orderBy);
		    foreach($orderProps as $prop)
		    {
		         if (isset($orderByMap[$prop]))
		         {
		             $newOrderBy .= ($orderByMap[$prop] . ","); 
		         }
		    }
		}
		if (strpos($newOrderBy,",") === strlen($newOrderBy) - 1)
		    $newOrderBy = substr($newOrderBy, 0, strlen($newOrderBy) - 1);
		
		$this->orderBy = $newOrderBy;
		
		$typeReflector = KalturaTypeReflectorCacher::get(get_class($this));
		
		foreach ( $this->getMapBetweenObjects() as $this_prop => $object_prop )
		{
		 	if ( is_numeric( $this_prop) ) 
		 		$this_prop = $object_prop;
		 		
			$value = $this->$this_prop;
			$propertyInfo = $typeReflector->getProperty($this_prop);
			if($propertyInfo->isDynamicEnum())
			{
				$value = $this->toDynamicEnumValue($propertyInfo->getType(), $value);
			}
			elseif($propertyInfo->getDynamicType())
			{
				$values = explode(',', $value);
				$finalValues = array();
				foreach($values as $val)
					$finalValues[] = $this->toDynamicEnumValue($propertyInfo->getDynamicType(), $val);
				$value = implode(',', $finalValues);
			}
			
		 	// convert the v3 prop name to the naming convension of the core filter
		 	$filter_prop_name = self::translatePropNames ( $object_prop );
		 	$object_to_fill->set($filter_prop_name, $value);
		 }		
		 		
		if(is_object($this->advancedSearch) && $this->advancedSearch instanceof KalturaSearchItem)
		{
//			KalturaLog::debug("Advanced Search [" . print_r($this->advancedSearch, true) . "]");
			$advancedSearch = $this->advancedSearch->toObject();
			if($advancedSearch)
				$object_to_fill->setAdvancedSearch($advancedSearch);
		}
			
		return $object_to_fill;		
	}	
	
	public function fromObject ( $source_object )
	{
		$reflector = KalturaTypeReflectorCacher::get(get_class($this));
		
{'fraction_non_alphanumeric': 0.15555555555555556, 'fraction_numerical': 0.001177336276674025, 'mean_word_length': 3.591891891891892, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 59, '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': '5000239', 'n_tokens_mistral': 2638, 'n_tokens_neox': 2316, 'n_words': 475}