<commit_before><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012 S.D.O.C. LTD. All rights reserved.
 * @license         GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Billing abstract fraud plugin class
 *
 * @package  plugin
 * @since    1.0
 */
abstract class Billrun_Plugin_BillrunPluginFraud extends Billrun_Plugin_BillrunPluginBase {

	/**
	 * plugin name
	 *
	 * @var string
	 */
	protected $name = 'Fraud';

	/**
	 * helper method to receive the last time of the monthly charge
	 * 
	 * @param boolean $return_timestamp if set to true return time stamp else full format of yyyymmddhhmmss
	 * 
	 * @return mixed timestamp or full format of time
	 * @deprecated since version 0.4 use Billrun_Util::getLastChargeTime instead
	 */
	protected function get_last_charge_time($return_timestamp = false) {
		return Billrun_Util::getLastChargeTime($return_timestamp);
	}
	
	/**
	 * method to collect data which need to be handle by event
	 */
	abstract public function handlerCollect($options);

	
		/**
	 * Write all the threshold that were broken as events to the db events collection 
	 * @param type $items the broken  thresholds
	 * @param type $pluginName the plugin that identified the threshold breakage
	 * @return type
	 */
	public function handlerAlert(&$items,$pluginName) {
		if($pluginName != $this->getName() || !$items ) {
			return;	
		}

		$events = Billrun_Factory::db()->eventsCollection();
		//Billrun_Factory::log()->log("New Alert For {$item['imsi']}",Zend_Log::DEBUG);
		$ret = array();
		foreach($items as &$item) { 
			$event = new Mongodloid_Entity($item);
			unset($event['lines_stamps']);
			
			$newEvent = $this->addAlertData($event);
			$newEvent['source']	= $this->getName();<commit_msg>add deprecated warning on old method get_last_charge_time<commit_after><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012 S.D.O.C. LTD. All rights reserved.
 * @license         GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Billing abstract fraud plugin class
 *
 * @package  plugin
 * @since    1.0
 */
abstract class Billrun_Plugin_BillrunPluginFraud extends Billrun_Plugin_BillrunPluginBase {

	/**
	 * plugin name
	 *
	 * @var string
	 */
	protected $name = 'Fraud';

	/**
	 * helper method to receive the last time of the monthly charge
	 * 
	 * @param boolean $return_timestamp if set to true return time stamp else full format of yyyymmddhhmmss
	 * 
	 * @return mixed timestamp or full format of time
	 * @deprecated since version 0.4 use Billrun_Util::getLastChargeTime instead
	 */
	protected function get_last_charge_time($return_timestamp = false) {
		Billrun_Factory::log()->log("Billrun_Plugin_BillrunPluginFraud::get_last_charge_time is deprecated; please use Billrun_Util::getLastChargeTime()", Zend_Log::DEBUG);
		return Billrun_Util::getLastChargeTime($return_timestamp);
	}
	
	/**
	 * method to collect data which need to be handle by event
	 */
	abstract public function handlerCollect($options);

	
		/**
	 * Write all the threshold that were broken as events to the db events collection 
	 * @param type $items the broken  thresholds
	 * @param type $pluginName the plugin that identified the threshold breakage
	 * @return type
	 */
	public function handlerAlert(&$items,$pluginName) {
		if($pluginName != $this->getName() || !$items ) {
			return;	
		}

		$events = Billrun_Factory::db()->eventsCollection();
		//Billrun_Factory::log()->log("New Alert For {$item['imsi']}",Zend_Log::DEBUG);
		$ret = array();
		foreach($items as &$item) { 
			$event = new Mongodloid_Entity($item);
			unset($event['lines_stamps']);
			
			$newEvent = $this->addAlertData($event);
			$newEvent['source']	= $this->getName();
{'fraction_non_alphanumeric': 0.11791322863987223, 'fraction_numerical': 0.004791056694170881, 'mean_word_length': 3.951251646903821, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '815940', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1084, 'n_words': 340}