ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_IOFactory Class Reference
+ Collaboration diagram for PHPExcel_IOFactory:

Static Public Member Functions

static getSearchLocations ()
 Get search locations.
static setSearchLocations ($value)
 Set search locations.
static addSearchLocation ($type= '', $location= '', $classname= '')
 Add search location.
static createWriter (PHPExcel $phpExcel, $writerType= '')
 Create PHPExcel_Writer_IWriter.
static createReader ($readerType= '')
 Create PHPExcel_Reader_IReader.
static load ($pFilename)
 Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution.
static createReaderForFile ($pFilename)
 Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution.

Private Member Functions

 __construct ()
 Private constructor for PHPExcel_IOFactory.

Static Private Attributes

static $_searchLocations
static $_autoResolveClasses

Detailed Description

Definition at line 54 of file IOFactory.php.

Constructor & Destructor Documentation

PHPExcel_IOFactory::__construct ( )
private

Private constructor for PHPExcel_IOFactory.

Definition at line 81 of file IOFactory.php.

{ }

Member Function Documentation

static PHPExcel_IOFactory::addSearchLocation (   $type = '',
  $location = '',
  $classname = '' 
)
static

Add search location.

Parameters
string$typeExample: IWriter
string$locationExample: PHPExcel/Writer/{0}.php
string$classnameExample: PHPExcel_Writer_{0}

Definition at line 113 of file IOFactory.php.

References $location, and $type.

{
self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
}
static PHPExcel_IOFactory::createReader (   $readerType = '')
static

Create PHPExcel_Reader_IReader.

Parameters
string$readerTypeExample: Excel2007
Returns
PHPExcel_Reader_IReader

Definition at line 155 of file IOFactory.php.

Referenced by createReaderForFile().

{
// Search type
$searchType = 'IReader';
// Include class
foreach (self::$_searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $readerType, $searchLocation['class']);
$classFile = str_replace('{0}', $readerType, $searchLocation['path']);
if (!class_exists($className)) {
require_once PHPEXCEL_ROOT . $classFile;
}
$instance = new $className();
if (!is_null($instance)) {
return $instance;
}
}
}
// Nothing found...
throw new Exception("No $searchType found for type $readerType");
}

+ Here is the caller graph for this function:

static PHPExcel_IOFactory::createReaderForFile (   $pFilename)
static

Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution.

Parameters
string$pFileName
Returns
PHPExcel_Reader_IReader
Exceptions
Exception

Definition at line 198 of file IOFactory.php.

References $reader, and createReader().

Referenced by load().

{
// Try loading using self::$_autoResolveClasses
foreach (self::$_autoResolveClasses as $autoResolveClass) {
$reader = self::createReader($autoResolveClass);
if ($reader->canRead($pFilename)) {
return $reader;
}
}
throw new Exception("Could not automatically determine PHPExcel_Reader_IReader for file.");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_IOFactory::createWriter ( PHPExcel  $phpExcel,
  $writerType = '' 
)
static

Create PHPExcel_Writer_IWriter.

Parameters
PHPExcel$phpExcel
string$writerTypeExample: Excel2007
Returns
PHPExcel_Writer_IWriter

Definition at line 124 of file IOFactory.php.

{
// Search type
$searchType = 'IWriter';
// Include class
foreach (self::$_searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $writerType, $searchLocation['class']);
$classFile = str_replace('{0}', $writerType, $searchLocation['path']);
if (!class_exists($className)) {
require_once PHPEXCEL_ROOT . $classFile;
}
$instance = new $className($phpExcel);
if (!is_null($instance)) {
return $instance;
}
}
}
// Nothing found...
throw new Exception("No $searchType found for type $writerType");
}
static PHPExcel_IOFactory::getSearchLocations ( )
static

Get search locations.

Returns
array

Definition at line 88 of file IOFactory.php.

References $_searchLocations.

static PHPExcel_IOFactory::load (   $pFilename)
static

Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution.

Parameters
string$pFileName
Returns
PHPExcel

Definition at line 186 of file IOFactory.php.

References $reader, and createReaderForFile().

{
return $reader->load($pFilename);
}

+ Here is the call graph for this function:

static PHPExcel_IOFactory::setSearchLocations (   $value)
static

Set search locations.

Parameters
array$value
Exceptions
Exception

Definition at line 98 of file IOFactory.php.

{
if (is_array($value)) {
self::$_searchLocations = $value;
} else {
throw new Exception('Invalid parameter passed.');
}
}

Field Documentation

PHPExcel_IOFactory::$_autoResolveClasses
staticprivate
Initial value:
array(
'Excel2007',
'Excel5',
'Serialized',
'CSV'
)

Definition at line 71 of file IOFactory.php.

PHPExcel_IOFactory::$_searchLocations
staticprivate
Initial value:
array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
)

Definition at line 61 of file IOFactory.php.

Referenced by getSearchLocations().


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