<commit_before><?php 
/** 
 * phpZenfolio - phpZenfolio is a PHP wrapper class for the Zenfolio API. The intention
 *		         of this class is to allow PHP application developers to quickly
 *			     and easily interact with the Zenfolio API in their applications,
 *			     without having to worry about the finer details of the API.
 *
 * @author <NAME> <<EMAIL>>
 * @version 1.0
 * @package phpZenfolio
 * @license GNU General Public License version 3 {@link http://www.gnu.org/licenses/gpl.html}
 * @copyright Copyright (c) 2010 <NAME>
 *
 * This file is part of phpZenfolio.
 *
 * phpZenfolio is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * phpZenfolio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with phpZenfolio.  If not, see <http://www.gnu.org/licenses/>.
 *
 * 
 * For more information about the class and upcoming tools and toys using it,
 * visit {@link http://phpzenfolio.com/}.
 *
 * For installation and usage instructions, open the README.txt file 
 * packaged with this class. If you don't have a copy, you can refer to the
 * documentation at:
 * 
 *          {@link http://phpzenfolio.com/docs/}
 * 
 * phpZenfolio is based on the worked I have done in phpSmug ({@link http://phpsmug.com}).
 *
 * Please help support the maintenance and development of phpZenfolio by making
 * a donation ({@link http://phpzenfolio.com/donate}).
 **/

/**
 * Set the error level.  I set this low to ensure there are no errors in phpZenfolio
 **/
error_reporting( E_NOTICE );

/**
 * We define our own exception so application developers can differentiate these
 * from other exceptions.
 */
class PhpZenfolioException extends Exception {}

/**
 * phpZenfolio - all of the phpZenfolio functionality is provided in this class
 *
 * @package phpZenfolio
 **/
class phpZenfolio {
	var $version = '1.0';
	private $cacheType = FALSE;
	private $cache_expire = 3600;
	private $keyring;
	private $id;
	protected $authToken;
	private $adapter = 'curl';

	/**
     * When your database cache table hits this many rows, a cleanup
     * will occur to get rid of all of the old rows and cleanup the
     * garbage in the table.  For most personal apps, 1000 rows should
     * be more than enough.  If your site gets hit by a lot of traffic
     * or you have a lot of disk space to spare, bump this number up.
     * You should try to set it high enough that the cleanup only
     * happens every once in a while, so this will depend on the growth
     * of your table.
     * 
     * @var integer
     **/
    var $max_cache_rows = 1000;
	
	/**
	 * Constructor to set up a phpZenfolio instance.
	 * 
	 * The Application Name (AppName) is obligatory as it helps Zenfolio identify
	 * your application and diagnose any problems users of your application may encounter.
	 *
	 * Please use a string and include your version number and URL, for example:
	 *
	 *  "My Cool App/1.0 (http://my.url.com)"
	 *
     * By default phpZenfolio will use the latest stable API endpoint, but you
	 * can over-ride this when instantiating the instance.
	 *
	 * @access public
	 * @param string	$AppName Name and version information of your application
	 *					in the form "AppName/version (URI)"
	 *					e.g. "My Cool App/1.0 (http://my.url.com)".
	 * @param string	$APIVer (Optional) API endpoint you wish to use.
	 *					Defaults to 1.4
	 * @return void
	 **/
	public function __construct()
	{
		$args = phpZenfolio::processArgs( func_get_args() );
		$this->APIVer = ( array_key_exists( 'APIVer', $args ) ) ? $args['APIVer'] : '1.4';
		// Set the Application Name
		if ( ! isset( $args['AppName'] ) ) {
			throw new PhpZenfolioException( 'Application name missing.', -10001 );
		}
		$this->AppName = $args['AppName'];
        // All calls to the API are done via POST using my own constructed httpRequest class
		$this->req = new httpRequest();
		$this->req->setConfig( array( 'adapter' => $this->adapter, 'follow_redirects' => TRUE, 'max_redirects' => 3, 'ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE, 'connect_timeout' => 60, 'monkey' => 5 ) );
		$this->req->setHeader( array( 'User-Agent' => "{$this->AppName} using phpZenfolio/{$this->version}",
									  'X-Zenfolio-User-Agent' => "{$this->AppName} using phpZenfolio/{$this->version}",
									  'Content-Type' => 'application/json' ) );
    }
	
	/**
	 * General debug function used for testing and development of phpZenfolio.
	 *
	 * Feel free to use this in your own application development.
	 *
	 * @access public
	 * @static
	 * @param mixed		$var Any string, object or array you want to display
	 * @param boolean	$echo Print the output or not.  This is only really used
	 *					for unit testing.<commit_msg>Removed test monkey setconfig option. Forgot to remove this previously<commit_after><?php 
/** 
 * phpZenfolio - phpZenfolio is a PHP wrapper class for the Zenfolio API. The intention
 *		         of this class is to allow PHP application developers to quickly
 *			     and easily interact with the Zenfolio API in their applications,
 *			     without having to worry about the finer details of the API.
 *
 * @author <NAME> <<EMAIL>>
 * @version 1.0
 * @package phpZenfolio
 * @license GNU General Public License version 3 {@link http://www.gnu.org/licenses/gpl.html}
 * @copyright Copyright (c) 2010 <NAME>
 *
 * This file is part of phpZenfolio.
 *
 * phpZenfolio is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * phpZenfolio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with phpZenfolio.  If not, see <http://www.gnu.org/licenses/>.
 *
 * 
 * For more information about the class and upcoming tools and toys using it,
 * visit {@link http://phpzenfolio.com/}.
 *
 * For installation and usage instructions, open the README.txt file 
 * packaged with this class. If you don't have a copy, you can refer to the
 * documentation at:
 * 
 *          {@link http://phpzenfolio.com/docs/}
 * 
 * phpZenfolio is based on the worked I have done in phpSmug ({@link http://phpsmug.com}).
 *
 * Please help support the maintenance and development of phpZenfolio by making
 * a donation ({@link http://phpzenfolio.com/donate}).
 **/

/**
 * Set the error level.  I set this low to ensure there are no errors in phpZenfolio
 **/
error_reporting( E_NOTICE );

/**
 * We define our own exception so application developers can differentiate these
 * from other exceptions.
 */
class PhpZenfolioException extends Exception {}

/**
 * phpZenfolio - all of the phpZenfolio functionality is provided in this class
 *
 * @package phpZenfolio
 **/
class phpZenfolio {
	var $version = '1.0';
	private $cacheType = FALSE;
	private $cache_expire = 3600;
	private $keyring;
	private $id;
	protected $authToken;
	private $adapter = 'curl';

	/**
     * When your database cache table hits this many rows, a cleanup
     * will occur to get rid of all of the old rows and cleanup the
     * garbage in the table.  For most personal apps, 1000 rows should
     * be more than enough.  If your site gets hit by a lot of traffic
     * or you have a lot of disk space to spare, bump this number up.
     * You should try to set it high enough that the cleanup only
     * happens every once in a while, so this will depend on the growth
     * of your table.
     * 
     * @var integer
     **/
    var $max_cache_rows = 1000;
	
	/**
	 * Constructor to set up a phpZenfolio instance.
	 * 
	 * The Application Name (AppName) is obligatory as it helps Zenfolio identify
	 * your application and diagnose any problems users of your application may encounter.
	 *
	 * Please use a string and include your version number and URL, for example:
	 *
	 *  "My Cool App/1.0 (http://my.url.com)"
	 *
     * By default phpZenfolio will use the latest stable API endpoint, but you
	 * can over-ride this when instantiating the instance.
	 *
	 * @access public
	 * @param string	$AppName Name and version information of your application
	 *					in the form "AppName/version (URI)"
	 *					e.g. "My Cool App/1.0 (http://my.url.com)".
	 * @param string	$APIVer (Optional) API endpoint you wish to use.
	 *					Defaults to 1.4
	 * @return void
	 **/
	public function __construct()
	{
		$args = phpZenfolio::processArgs( func_get_args() );
		$this->APIVer = ( array_key_exists( 'APIVer', $args ) ) ? $args['APIVer'] : '1.4';
		// Set the Application Name
		if ( ! isset( $args['AppName'] ) ) {
			throw new PhpZenfolioException( 'Application name missing.', -10001 );
		}
		$this->AppName = $args['AppName'];
        // All calls to the API are done via POST using my own constructed httpRequest class
		$this->req = new httpRequest();
		$this->req->setConfig( array( 'adapter' => $this->adapter, 'follow_redirects' => TRUE, 'max_redirects' => 3, 'ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE, 'connect_timeout' => 60 ) );
		$this->req->setHeader( array( 'User-Agent' => "{$this->AppName} using phpZenfolio/{$this->version}",
									  'X-Zenfolio-User-Agent' => "{$this->AppName} using phpZenfolio/{$this->version}",
									  'Content-Type' => 'application/json' ) );
    }
	
	/**
	 * General debug function used for testing and development of phpZenfolio.
	 *
	 * Feel free to use this in your own application development.
	 *
	 * @access public
	 * @static
	 * @param mixed		$var Any string, object or array you want to display
	 * @param boolean	$echo Print the output or not.  This is only really used
	 *					for unit testing.
{'fraction_non_alphanumeric': 0.09982486865148861, 'fraction_numerical': 0.007491729908542518, 'mean_word_length': 3.251033912324235, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 56, 'https://': 0, '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': '58355', 'n_tokens_mistral': 3204, 'n_tokens_neox': 2927, 'n_words': 1276}