<commit_before><?php

/**
 * An adapter implemented using the Zend Framework HTTP Client.
 *
 * @package    PHPCouch
 * @subpackage Adapter
 *
 * @author     <NAME> <<EMAIL>>
 * @copyright  Bitextender GmbH
 *
 * @since      1.0.0
 *
 * @version    $Id$
 */
class PhpcouchZendhttpclientAdapter implements PhpcouchIAdapter
{
	/**
	 * Adapter constructor.
	 *
	 * @param      array An array of initialization options for this driver implementation.
	 *
	 * @author     <NAME> <<EMAIL>>
	 * @since      1.0.0
	 */
	public function __construct(array $options = array())
	{
		// try an autoload
		if(!class_exists('Zend_Http_Client')) {
			// nope. Zend loves to be on the include path, though
			require('Zend/Http/Client.php');
		}
		
		// by default, we override two options, keepalive (nice when doing multiple requests) and the user agent string
		$options = array_merge(array(
			'keepalive'    => true,
			'useragent'    => Phpcouch::getVersionString(),
		), $options);
		
		// make a client instance
		$this->client = new Zend_Http_Client();
		// and feed it our options
		$this->client->setConfig($options);
	}
	
	/**
	 * Get the client class instance.
	 *
	 * @param      bool Whether or not to reset the client before it is returned (default true).<commit_msg>zend adapter should work again now<commit_after><?php

/**
 * An adapter implemented using the Zend Framework HTTP Client.
 *
 * @package    PHPCouch
 * @subpackage Adapter
 *
 * @author     <NAME> <<EMAIL>>
 * @copyright  Bitextender GmbH
 *
 * @since      1.0.0
 *
 * @version    $Id$
 */
class PhpcouchZendhttpclientAdapter implements AdapterInterface
{
	/**
	 * Adapter constructor.
	 *
	 * @param      array An array of initialization options for this driver implementation.
	 *
	 * @author     <NAME> <<EMAIL>>
	 * @since      1.0.0
	 */
	public function __construct(array $options = array(), $clientClass = 'Zend_Http_Client')
	{
		// by default, we override two options, keepalive (nice when doing multiple requests) and the user agent string
		$options = array_merge(array(
			'keepalive'    => true,
			'useragent'    => Phpcouch::getVersionString(),
		), $options);
		
		// make a client instance
		// we rely on Zend_Loader's autoloader being active. That's the user's job though
		$this->client = new $clientClass();
		// and feed it our options
		$this->client->setConfig($options);
	}
	
	/**
	 * Get the client class instance.
	 *
	 * @param      bool Whether or not to reset the client before it is returned (default true).
{'fraction_non_alphanumeric': 0.118562874251497, 'fraction_numerical': 0.004790419161676647, 'mean_word_length': 3.1014729950900164, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, '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': '3002400', 'n_tokens_mistral': 820, 'n_tokens_neox': 744, 'n_words': 249}