Property | Type | Description | |
---|---|---|---|
$defaultRowStyle | Default row style. Each writer can have its own default style | ||
$filePointer | Pointer to the file/stream we will write to | ||
$globalFunctionsHelper | Helper to work with global functions | ||
$headerContentType | Content-Type value for the header - to be defined by child class | ||
$isWriterOpened | Indicates whether the writer has been opened or not | ||
$outputFilePath | Path to the output file | ||
$rowStyle | Style to be applied to the next written row(s) |
Method | Description | |
---|---|---|
__construct ( ) | ||
addRow ( array $dataRow ) : |
Write given data to the output. New data will be appended to end of stream. | |
addRowWithStyle ( array $dataRow, |
Write given data to the output and apply the given style. | |
addRows ( array $dataRows ) : |
Write given data to the output. New data will be appended to end of stream. | |
addRowsWithStyle ( array $dataRows, |
Write given data to the output and apply the given style. | |
close ( ) : void | Closes the writer. This will close the streamer as well, preventing new data to be written to the file. | |
openToBrowser ( string $outputFileName ) : |
Inits the writer and opens it to accept data. | |
openToFile ( string $outputFilePath ) : |
Inits the writer and opens it to accept data. | |
setDefaultRowStyle ( |
Sets the default styles for all rows added with "addRow". | |
setGlobalFunctionsHelper ( Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper ) : |
Method | Description | |
---|---|---|
addRowToWriter ( array $dataRow, |
Adds data to the currently openned writer. | |
closeWriter ( ) : void | Closes the streamer, preventing any additional writing. | |
getDefaultRowStyle ( ) : |
Returns the default style to be applied to rows. | |
openWriter ( ) : void | Opens the streamer and makes it ready to accept data. | |
throwIfFilePointerIsNotAvailable ( ) : void | Checks if the pointer to the file/stream to write to is available. | |
throwIfWriterAlreadyOpened ( string $message ) : void | Checks if the writer has already been opened, since some actions must be done before it gets opened. |
Method | Description | |
---|---|---|
closeAndAttemptToCleanupAllFiles ( ) : void | Closes the writer and attempts to cleanup all files that were created during the writing process (temp files & final file). | |
resetRowStyleToDefault ( ) : void | Resets the style to be applied to the next written rows. | |
setRowStyle ( |
Sets the style to be applied to the next written rows until it is changed or reset. |
abstract protected addRowToWriter ( array $dataRow, |
||
$dataRow | array | Array containing data to be streamed. Example $dataRow = ['data1', 1234, null, '', 'data5']; |
$style | Style to be applied to the written row | |
return | void |
public addRowWithStyle ( array $dataRow, |
||
$dataRow | array | Array of array containing data to be streamed. |
$style | Style to be applied to the row. | |
return |
public addRowsWithStyle ( array $dataRows, |
||
$dataRows | array | Array of array containing data to be streamed. |
$style | Style to be applied to the rows. | |
return |
abstract protected closeWriter ( ) : void | ||
return | void |
protected getDefaultRowStyle ( ) : |
||
return |
public openToBrowser ( string $outputFileName ) : |
||
$outputFileName | string | Name of the output file that will contain the data. If a path is passed in, only the file name will be kept |
return |
public openToFile ( string $outputFilePath ) : |
||
$outputFilePath | string | Path of the output file that will contain the data |
return |
abstract protected openWriter ( ) : void | ||
return | void |
public setDefaultRowStyle ( |
||
$defaultStyle | ||
return |
public setGlobalFunctionsHelper ( Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper ) : |
||
$globalFunctionsHelper | Box\Spout\Common\Helper\GlobalFunctionsHelper | |
return |
protected throwIfFilePointerIsNotAvailable ( ) : void | ||
return | void |
protected throwIfWriterAlreadyOpened ( string $message ) : void | ||
$message | string | Error message |
return | void |
protected $defaultRowStyle |
protected $globalFunctionsHelper |
protected static $headerContentType |
protected $isWriterOpened |