|
@@ 142-156 (lines=15) @@
|
| 139 |
|
* |
| 140 |
|
* @return null |
| 141 |
|
*/ |
| 142 |
|
public function parse ( $data = null, $type = null, $delimiter = null ) { |
| 143 |
|
if ( !empty( $data ) ) |
| 144 |
|
$this->input = $data; |
| 145 |
|
|
| 146 |
|
if ( !empty( $type ) && in_array( $type, $this->types ) ) |
| 147 |
|
$this->type = $type; |
| 148 |
|
|
| 149 |
|
if ( !empty( $delimiter ) ) |
| 150 |
|
$this->delimiter = $delimiter; |
| 151 |
|
|
| 152 |
|
if ( method_exists( $this, "parse_{$this->type}" ) ) |
| 153 |
|
return call_user_func( array( $this, 'parse_' . $this->type ) ); |
| 154 |
|
|
| 155 |
|
return $this->parsed; |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
/** |
| 159 |
|
* @param array $data Array of data |
|
@@ 383-397 (lines=15) @@
|
| 380 |
|
* |
| 381 |
|
* @return mixed |
| 382 |
|
*/ |
| 383 |
|
public function export ( $data = null, $type = null, $delimiter = null ) { |
| 384 |
|
if ( !empty( $data ) ) |
| 385 |
|
$this->set_data( $data ); |
| 386 |
|
|
| 387 |
|
if ( !empty( $type ) && in_array( $type, $this->types ) ) |
| 388 |
|
$this->type = $type; |
| 389 |
|
|
| 390 |
|
if ( !empty( $delimiter ) ) |
| 391 |
|
$this->delimiter = $delimiter; |
| 392 |
|
|
| 393 |
|
if ( method_exists( $this, "build_{$this->type}" ) ) |
| 394 |
|
call_user_func( array( $this, 'build_' . $this->type ) ); |
| 395 |
|
|
| 396 |
|
return $this->built; |
| 397 |
|
} |
| 398 |
|
|
| 399 |
|
/** |
| 400 |
|
* @param array $data Array of data |