36 namespace SimpleExcel;
40 if (!class_exists(
'Composer\\Autoload\\ClassLoader',
false)){
42 spl_autoload_register(
function($class_name){
43 if($class_name !=
'SimpleExcel') require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.str_replace(
'\\', DIRECTORY_SEPARATOR, substr($class_name, strlen(
'SimpleExcel\\'))).
'.php');
71 protected $validParserTypes = array(
'XML',
'CSV',
'TSV',
'HTML',
'JSON');
72 protected $validWriterTypes = array(
'XML',
'CSV',
'TSV',
'HTML',
'JSON');
81 $this->constructParser($filetype);
82 $this->constructWriter($filetype);
92 $filetype = strtoupper($filetype);
93 if(!in_array($filetype, $this->validParserTypes)){
96 $parser_class =
'SimpleExcel\\Parser\\'.$filetype.
'Parser';
97 $this->parser =
new $parser_class();
108 $filetype = strtoupper($filetype);
110 if(!in_array($filetype, $this->validWriterTypes)){
113 $writer_class =
'SimpleExcel\\Writer\\'.$filetype.
'Writer';
114 $this->writer =
new $writer_class();
123 $this->constructWriter($filetype);
124 $this->writer->setData($this->parser->getField());