<commit_before><?php

/**
 * Amazon S3 Class
 *
 * @package		AmazonS3
 * @category	Package
 * @author		<NAME>
 * @link		https://github.com/dmyers/fuel-amazons3
 */
 
namespace AmazonS3;

require_once PKGPATH.'amazons3'.DS.'vendor'.DS.'amazons3'.DS.'S3.php';

class AmazonS3 extends \S3
{
	/**
	 * loaded amazon s3 instance
	 */
	protected static $_instance = null;

	/**
	 * Initialize by loading config
	 */
	public static function _init()
	{
		\Config::load('amazons3', true);
		
		self::$useExceptions = true;
	}

	/**
	 * Returns a new amazon s3 object.
	 *
	 *     $amazons3 = AmazonS3::forge();
	 *
	 * @param	void
	 * @access	public
	 * @return  AmazonS3
	 */
	public static function forge()
	{
		$config = \Config::get('amazons3');
		
		if (empty($config['access_key_id'])) {
			throw new AmazonS3Exception('You must set the access_key_id config');
		}

		if (empty($config['secret_access_key'])) {
			throw new AmazonS3Exception('You must set the secret_access_key config');
		}
		
		return new static($config['access_key_id'], $config['secret_access_key'], $config['use_ssl']);
	}

	/**
	 * create or return the amazons3 instance
	 *
	 * @param	void
	 * @access	public
	 * @return	AmazonS3 object
	 */
	public static function instance()
	{
		if (self::$_instance === null) {
			self::$_instance = self::forge();
		}

		return self::$_instance;
	}

	public static function putObject($input, $bucket = null, $uri, $acl = null, $metaHeaders = array(), $requestHeaders = array(), $storageClass = self::STORAGE_CLASS_STANDARD)
	{
		if (empty($bucket)) {
			$bucket = \Config::get('amazons3.default_bucket');
		}

		if (empty($acl)) {
			$acl = \Config::get('amazons3.default_acl');
		}

		return parent::putObject($input, $bucket, $uri, $acl, $metaHeaders, $requestHeaders, $storageClass);
	}

}

class AmazonS3Exception extends \FuelException {
}<commit_msg>Added overrides of s3 functions for default bucket and ACL<commit_after><?php

/**
 * Amazon S3 Class
 *
 * @package		AmazonS3
 * @category	Package
 * @author		<NAME>
 * @link		https://github.com/dmyers/fuel-amazons3
 */
 
namespace AmazonS3;

require_once PKGPATH.'amazons3'.DS.'vendor'.DS.'amazons3'.DS.'S3.php';

class AmazonS3 extends \S3
{
	/**
	 * loaded amazon s3 instance
	 */
	protected static $_instance = null;

	/**
	 * Initialize by loading config
	 */
	public static function _init()
	{
		\Config::load('amazons3', true);
		
		self::$useExceptions = true;
	}

	/**
	 * Returns a new amazon s3 object.
	 *
	 *     $amazons3 = AmazonS3::forge();
	 *
	 * @param	void
	 * @access	public
	 * @return  AmazonS3
	 */
	public static function forge()
	{
		$config = \Config::get('amazons3');
		
		if (empty($config['access_key_id'])) {
			throw new AmazonS3Exception('You must set the access_key_id config');
		}

		if (empty($config['secret_access_key'])) {
			throw new AmazonS3Exception('You must set the secret_access_key config');
		}
		
		return new static($config['access_key_id'], $config['secret_access_key'], $config['use_ssl']);
	}

	/**
	 * create or return the amazons3 instance
	 *
	 * @param	void
	 * @access	public
	 * @return	AmazonS3 object
	 */
	public static function instance()
	{
		if (self::$_instance === null) {
			self::$_instance = self::forge();
		}

		return self::$_instance;
	}

	public static function putObject($input, $bucket = null, $uri, $acl = null, $metaHeaders = array(), $requestHeaders = array(), $storageClass = self::STORAGE_CLASS_STANDARD)
	{
		if (empty($bucket)) {
			$bucket = \Config::get('amazons3.default_bucket');
		}

		if (empty($acl)) {
			$acl = \Config::get('amazons3.default_acl', self::ACL_PRIVATE);
		}

		return parent::putObject($input, $bucket, $uri, $acl, $metaHeaders, $requestHeaders, $storageClass);
	}

	public static function putObjectFile($file, $bucket = null, $uri, $acl = null, $metaHeaders = array(), $contentType = null)
	{
		return self::putObject(self::inputFile($file), $bucket, $uri, $acl, $metaHeaders, $contentType);
	}

	public static function putObjectString($string, $bucket = null, $uri, $acl = null, $metaHeaders = array(), $contentType = 'text/plain')
	{
		return self::putObject($string, $bucket, $uri, $acl, $metaHeaders, $contentType);
	}
}

class AmazonS3Exception extends \FuelException {}
{'fraction_non_alphanumeric': 0.1595669569310426, 'fraction_numerical': 0.011061426217933632, 'mean_word_length': 4.095923261390888, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5589834', 'n_tokens_mistral': 1552, 'n_tokens_neox': 1413, 'n_words': 338}