Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/type/data/data.php
<?php
/**
 * @version		1.0.0
 * @category	Anahita Social Engine™
 * @copyright	Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.anahitapolis.com
 */

class AnTypeData extends KObject
{
	/**
	 * 
	 * @var mixed
	 */
	protected $_data;
	
	/**
	 * 
	 * @var string
	 */
	protected $_mimeType;
	

	/**
	 * 
	 * @return AnTypeData
	 * @param $options array
	 */
	static public function factory(array $options=array())
	{
		if ( isset($options['path']) ) {
			$options['data'] = file_get_contents($options['path']);
			unset($options['path']);
		}
		
		return new AnTypeData($options);
	}
	
	/**
	 * CONSTRUCTOR
	 * @param $data				string bites
	 * @param $mimeType			string data mimeType
	 * @return null
	 */
	public function __construct($options=array())
	{
		$options = $this->_initialize($options);
		$this->_data = $options['data'];
		$this->_mime = $options['mime_type'];
	}
	
	/**
	 * 
	 * 
	 * @return 
	 * @param $options array
	 */
	protected function _initialize($options)
	{
		$default = array(
			'data' 		=> '',
			'mime_type' => null
		);
		
		return array_merge($default, $options);
	}
	
	/**
	 * Return data mimetype
	 * @return string
	 */
	public function getMimeType()
	{
		return $this->_mimeType;
	}
		
	/**
	 * Return data
	 * @return mixed 
	 */
	public function getData()
	{
		return $this->_data;
	}
		
	public function __toString()
	{
		return (string)$this->_data;
	}
	
//end class	
}
Return current item: Anahita Social Engine