Doctrine 1.2.4
Doctrine_Parser_Serialize Class Reference

Inherits Doctrine_Parser.

Public Member Functions

 doDump ($data, $path=null)
 
 doLoad ($path)
 
 dumpData ($array, $path=null, $charset=null)
 
 loadData ($path)
 

Static Public Member Functions

static dump ($array, $type= 'xml', $path=null, $charset=null)
 
static getParser ($type)
 
static load ($path, $type= 'xml')
 

Detailed Description

Definition at line 33 of file Serialize.php.

Member Function Documentation

Doctrine_Parser::doDump (   $data,
  $path = null 
)
inherited

doDump

Parameters
string$data
string$path
Returns
void

Definition at line 145 of file Parser.php.

{
if ($path !== null) {
return file_put_contents($path, $data);
} else {
return $data;
}
}
Doctrine_Parser::doLoad (   $path)
inherited

doLoad

Get contents whether it is the path to a file file or a string of txt. Either should allow php code in it.

Parameters
string$path
Returns
void

Definition at line 120 of file Parser.php.

{
ob_start();
if ( ! file_exists($path)) {
$contents = $path;
$path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'dparser_' . microtime();
file_put_contents($path, $contents);
}
include($path);
// Fix #1569. Need to check if it's still all valid
$contents = ob_get_clean(); //iconv("UTF-8", "UTF-8", ob_get_clean());
return $contents;
}
static Doctrine_Parser::dump (   $array,
  $type = 'xml',
  $path = null,
  $charset = null 
)
staticinherited

dump

Interface for pulling and dumping data to a file

Parameters
string$array
string$path
string$type
string$charsetThe charset of the data being dumped
Returns
void
Author
Jonathan H. Wage

Definition at line 104 of file Parser.php.

{
$parser = self::getParser($type);
return $parser->dumpData($array, $path, $charset);
}
Doctrine_Parser_Serialize::dumpData (   $array,
  $path = null,
  $charset = null 
)

dumpData

Dump an array of data to a specified path or return

Parameters
string$array
string$path
string$charsetThe charset of the data being dumped
Returns
void

Definition at line 45 of file Serialize.php.

{
$data = serialize($array);
return $this->doDump($data, $path);
}
static Doctrine_Parser::getParser (   $type)
staticinherited

getParser

Get instance of the specified parser

Parameters
string$type
Returns
void
Author
Jonathan H. Wage

Definition at line 68 of file Parser.php.

{
$class = 'Doctrine_Parser_'.ucfirst($type);
return new $class;
}
static Doctrine_Parser::load (   $path,
  $type = 'xml' 
)
staticinherited

load

Interface for loading and parsing data from a file

Parameters
string$path
string$type
Returns
void
Author
Jonathan H. Wage

Definition at line 85 of file Parser.php.

{
$parser = self::getParser($type);
return (array) $parser->loadData($path);
}
Doctrine_Parser_Serialize::loadData (   $path)

loadData

Load and unserialize data from a file or from passed data

Parameters
string$path
Returns
void

Definition at line 60 of file Serialize.php.

{
$contents = $this->doLoad($path);
return unserialize($contents);
}

The documentation for this class was generated from the following file: