<commit_before><?php namespace VPS;

class MailChimp
{
	
	private $apiKey;
	private $apiUrl = 'https://<dc>.api.mailchimp.com/3.0/';
	
	/** 
	* Create a new instance
	* @param string $apiKey - Optional
	*/
	public function __construct($apiKey = false)
	{
		if($apiKey){ 
			$this->apiKey = $apiKey;
			list(, $datacentre) = explode('-', $this->apiKey);
			$this->apiUrl = str_replace('<dc>', $datacentre, $this->apiUrl);
		}
	}
	
	/** 
	* Method to Set Api Key
	* @param string $apiKey
	*/
	public function setApiKey($apiKey)
	{
		$this->apiKey = $apiKey;
		list(, $datacentre) = explode('-', $this->apiKey);
		$this->apiUrl = str_replace('<dc>', $datacentre, $this->apiUrl);
	}
	
	/** 
	* Magic Method to request http verb
	* @return array
	*/
	public function __call($method, $arguments)
	{
		$httpVerb = strtoupper($method);
		$allowedHttpVerbs = ['GET', 'POST', 'PATCH', 'DELETE'];
		
		//Validate http verb
		if(in_array($httpVerb, $allowedHttpVerbs)){
			return $this->request($httpVerb, array_shift($arguments), $arguments);
		}
		
		throw new \Exception('Invalid http verb!');
	}
	
	/** 
	* Call MailChimp API
	* @param string $httpVerb
	* @param string $endPoint - (http://kb.mailchimp.com/api/resources)
	* @param array $data - Optional
	* @return array
	*/
	public function request($httpVerb = 'GET', $endPoint, array $data = [])
	{
		//validate API
		if(! $this->apiKey){
			throw new \Exception('MailChimp API Key must be set before making request!');
		}
		
		$endPoint = ltrim($endPoint, '/');
		$httpVerb = strtoupper($httpVerb);
		$requestUrl = $this->apiUrl.$endPoint;
		
		return $this->curlRequest($requestUrl, $httpVerb, $data);
	}<commit_msg>Update class<commit_after><?php namespace VPS;

class MailChimp
{
	
	private $apiKey;
	private $apiUrl = 'https://<dc>.api.mailchimp.com/3.0/';
	
	/** 
	* Create a new instance
	* @param string $apiKey - Optional
	*/
	public function __construct($apiKey = false)
	{
		if($apiKey){ 
			$this->apiKey = $apiKey;
			list(, $datacentre) = explode('-', $this->apiKey);
			$this->apiUrl = str_replace('<dc>', $datacentre, $this->apiUrl);
		}
	}
	
	/** 
	* Method to Set Api Key
	* @param string $apiKey
	*/
	public function setApiKey($apiKey)
	{
		$this->apiKey = $apiKey;
		list(, $datacentre) = explode('-', $this->apiKey);
		$this->apiUrl = str_replace('<dc>', $datacentre, $this->apiUrl);
	}
	
	/** 
	* Magic Method to request http verb
	* @return array
	*/
	public function __call($method, $arguments)
	{
		$httpVerb = strtoupper($method);
		$allowedHttpVerbs = ['GET', 'POST', 'PATCH', 'DELETE'];
		
		//Validate http verb
		if(in_array($httpVerb, $allowedHttpVerbs)){
			$endPoint = $arguments[0];
			$data = isset($arguments[1]) ? $arguments[1] : [];
			return $this->request($httpVerb, $endPoint, $data);
		}
		
		throw new \Exception('Invalid http verb!');
	}
	
	/** 
	* Call MailChimp API
	* @param string $httpVerb
	* @param string $endPoint - (http://kb.mailchimp.com/api/resources)
	* @param array $data - Optional
	* @return array
	*/
	public function request($httpVerb = 'GET', $endPoint, array $data = [])
	{
		//validate API
		if(! $this->apiKey){
			throw new \Exception('MailChimp API Key must be set before making request!');
		}
		
		$endPoint = ltrim($endPoint, '/');
		$httpVerb = strtoupper($httpVerb);
		$requestUrl = $this->apiUrl.$endPoint;
		
		return $this->curlRequest($requestUrl, $httpVerb, $data);
	}
{'fraction_non_alphanumeric': 0.18189858490566038, 'fraction_numerical': 0.002063679245283019, 'mean_word_length': 3.8059490084985836, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, 'https://': 2, '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': '3999284', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1227, 'n_words': 276}