<?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 AnUtilData extends KObject
{
protected $_data;
protected $_mimeType;
static function dataWithContentsOfFile($path, $mimeType)
{
$data = file_get_contents($path);
return new AnUtilData(array('data'=>$data,'mime_type'=>$mimeType));
}
/**
* 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'];
}
protected function _initialize($options)
{
$default = array(
'data' => '',
'mime_type' => null
);
return array_merge($default, $options);
}
/**
* Method to get the data mime type
* @return STRING mime type
*/
public function getMimeType()
{
return $this->_mimeType;
}
/**
* Method to get the data
* @return STRING
*/
public function getData()
{
return $this->_data;
}
public function __toString()
{
return $this->_data;
}
//end class
}