<commit_before><?php
/**
 * @category   Kynx
 * @package    Kynx_Service
 * @subpackage Rackspace
 * @copyright  Copyright (c) 2012 <NAME> (http://www.kynx.org)
 * @license    https://github.com/kynx/Kynx/blob/master/LICENSE New BSD
 */
/**
 * @see Zend_Service_Rackspace_Files
 */
require_once 'Zend/Service/Rackspace/Files.php';
/**
 * Extends Zend_Service_Rackspace_Files to provide streaming capabilities
 * 
 * @category   Kynx
 * @package    Kynx_Service
 * @subpackage Rackspace
 * @copyright  Copyright (c) 2012 <NAME> (http://www.kynx.org)
 * @license    https://github.com/kynx/Kynx/blob/master/LICENSE New BSD
 */
class Kynx_Service_Rackspace_Files extends Zend_Service_Rackspace_Files
{
    const HEADER_RANGE                         = 'Range';
    const HEADER_TRANSFER_ENCODING             = 'Transfer-Encoding';
    const WRAPPER_NAME                         = 'rscf';
    
    /**
     * Array of wrapper clients
     * 
     * @var Kynx_Service_Rackspace_Files_Stream[]
     */
    protected static $wrapperClients = array();
    
    /**
     * Options for wrapper clients
     * @var array
     */
    protected $wrapperOptions = array();
    
    /**
     * Object being sent using chunked encoding
     * 
     * @var array
     */
    protected $chunkedObject;
    
    /**
     * Class to perform checksums
     * 
     * @var Kynx_Service_Rackspace_Files_Checksum_Interface
     */
    protected $checkSummer;
    
    /**
     * Get an object using streaming
     *
     * Can use either provided filename for storage or create a temp file if none provided.
     * 
     * @param string $container
     * @param string $object
     * @param mixed $streamfile  resource|string
     */
    public function getObjectIntoStream($container, $object, $streamfile = null)
    {
        $this->getHttpClient()->setStream($streamfile?$streamfile:true);
        $rv = $this->getObject($container, $object);
        $this->getHttpClient()->setStream(null);

        return $rv;
    }

    /**
     * Gets range of bytes of an object
     *
     * @param string $container
     * @param string $object
     * @param integer $start
     * @param integer $end
     * @param array $headers
     * @return Zend_Service_Rackspace_Files_Object|boolean
     * @throws Kynx_Service_Rackspace_Files_Exception
     */
    public function getObjectRange($container,$object,$start='',$end='',$headers=array())
    {<commit_msg>Changes to allow setting Zend_Http_Client config<commit_after><?php
/**
 * @category   Kynx
 * @package    Kynx_Service
 * @subpackage Rackspace
 * @copyright  Copyright (c) 2012 <NAME> (http://www.kynx.org)
 * @license    https://github.com/kynx/Kynx/blob/master/LICENSE New BSD
 */
/**
 * @see Zend_Service_Rackspace_Files
 */
require_once 'Zend/Service/Rackspace/Files.php';
/**
 * Extends Zend_Service_Rackspace_Files to provide streaming capabilities
 * 
 * @category   Kynx
 * @package    Kynx_Service
 * @subpackage Rackspace
 * @copyright  Copyright (c) 2012 <NAME> (http://www.kynx.org)
 * @license    https://github.com/kynx/Kynx/blob/master/LICENSE New BSD
 */
class Kynx_Service_Rackspace_Files extends Zend_Service_Rackspace_Files
{
    const HEADER_RANGE                         = 'Range';
    const HEADER_TRANSFER_ENCODING             = 'Transfer-Encoding';
    const WRAPPER_NAME                         = 'rscf';
    
    /**
     * Array of wrapper clients
     * 
     * @var Kynx_Service_Rackspace_Files_Stream[]
     */
    protected static $wrapperClients = array();
    
    /**
     * Options for wrapper clients
     * @var array
     */
    protected $wrapperOptions = array();
    
    /**
     * Object being sent using chunked encoding
     * 
     * @var array
     */
    protected $chunkedObject;
    
    /**
     * Class to perform checksums
     * 
     * @var Kynx_Service_Rackspace_Files_Checksum_Interface
     */
    protected $checkSummer;
    
    protected $clientConfig = array();
    
    /**
     * Sets config for httpd client
     * 
     * @see Zend_Httpd_Client::setConfig();
     * @param array $config
     */
    public function setClientConfig($config) 
    {
        $this->clientConfig = $config;
    }
    
    /**
     * Get an object using streaming
     *
     * Can use either provided filename for storage or create a temp file if none provided.
     * 
     * @param string $container
     * @param string $object
     * @param mixed $streamfile  resource|string
     */
    public function getObjectIntoStream($container, $object, $streamfile = null)
    {
        $this->getHttpClient()->setStream($streamfile?$streamfile:true);
        $rv = $this->getObject($container, $object);
        $this->getHttpClient()->setStream(null);

        return $rv;
    }

    /**
     * Gets range of bytes of an object
     *
     * @param string $container
     * @param string $object
     * @param integer $start
     * @param integer $end
     * @param array $headers
     * @return Zend_Service_Rackspace_Files_Object|boolean
     * @throws Kynx_Service_Rackspace_Files_Exception
     */
    public function getObjectRange($container,$object,$start='',$end='',$headers=array())
    {
{'fraction_non_alphanumeric': 0.11124008512284775, 'fraction_numerical': 0.0030953762816792415, 'mean_word_length': 2.5266030013642564, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 18, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '6481985', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1554, 'n_words': 353}