<commit_before><?php defined('SYSPATH') OR die('No direct script access.');

/**
 * Exceptionalio service adapter
 * requires 'api-key' configuration
 * 
 * @package    Despark/services-manager
 * @author     <NAME>
 * @copyright  (c) 2012 Despark Ltd.
 * @license    http://creativecommons.org/licenses/by-sa/3.0/legalcode
 */
abstract class Kohana_Service_Mailchimp extends Service implements Service_Type_Php
{
	public $_api;

	public function api()
	{
		if ( ! $this->initialized())
			return NULL;

		return $this->_api;
	}

	public function __call($method, $args)
	{
		if ( ! $this->initialized())
			return NULL;
		
		if (strpos($method, 'list') !== FALSE AND strpos($method, 'lists') === FALSE)
		{
			$args[0] = Arr::path($this->_config, 'lists.'.$args[0], $args[0]);
		}

		$return = call_user_func_array(array($this->_api, $method), $args);
		
		if ($this->_api->errorCode)
		{
			throw new Service_Mailchimp_Exception($this->_api->errorMessage, NULL, $this->_api->errorCode);
		}

		return $return;
	}

	/**
	 * Run Exceptional setup
	 * @return NULL
	 */
	public function init()
	{
		require_once Kohana::find_file("vendor", 'MCAPI.class');

		$this->api_key = $this->_config['api-key'];

		$this->_api = new MCAPI($this->_config['api-key']);
	}

}<commit_msg>Added option for multiple campaigns for single newsletter Added campaign segment condition for excluding emails from clippings which appear on openbuildings newsletter list<commit_after><?php defined('SYSPATH') OR die('No direct script access.');

/**
 * Exceptionalio service adapter
 * requires 'api-key' configuration
 * 
 * @package    Despark/services-manager
 * @author     <NAME>
 * @copyright  (c) 2012 Despark Ltd.
 * @license    http://creativecommons.org/licenses/by-sa/3.0/legalcode
 */
abstract class Kohana_Service_Mailchimp extends Service implements Service_Type_Php
{
	public $_api;

	public function api()
	{
		if ( ! $this->initialized())
			return NULL;

		return $this->_api;
	}

	public function __call($method, $args)
	{
		if ( ! $this->initialized())
			return NULL;
		
		if (strpos($method, 'listSubscribe') !== FALSE OR strpos($method, 'listUnsubscribe'))
		{
			$args[0] = Arr::path($this->_config, 'lists.'.$args[0], $args[0]);
		}

		$return = call_user_func_array(array($this->_api, $method), $args);
		
		if ($this->_api->errorCode)
		{
			throw new Service_Mailchimp_Exception($this->_api->errorMessage, NULL, $this->_api->errorCode);
		}

		return $return;
	}

	/**
	 * Run Exceptional setup
	 * @return NULL
	 */
	public function init()
	{
		require_once Kohana::find_file("vendor", 'MCAPI.class');

		$this->api_key = $this->_config['api-key'];

		$this->_api = new MCAPI($this->_config['api-key']);
	}

}
{'fraction_non_alphanumeric': 0.1647622558053815, 'fraction_numerical': 0.006634721710283818, 'mean_word_length': 4.0919324577861165, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 35, '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': '2631226', 'n_tokens_mistral': 974, 'n_tokens_neox': 886, 'n_words': 203}