PHP 클래스 Box\Spout\Writer\AbstractWriter

상속: implements Box\Spout\Writer\WriterInterface
파일 보기 프로젝트 열기: box/spout

보호된 프로퍼티들

프로퍼티 타입 설명
$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)

공개 메소드들

메소드 설명
__construct ( )
addRow ( array $dataRow ) : AbstractWriter Write given data to the output. New data will be appended to end of stream.
addRowWithStyle ( array $dataRow, Style $style ) : AbstractWriter Write given data to the output and apply the given style.
addRows ( array $dataRows ) : AbstractWriter Write given data to the output. New data will be appended to end of stream.
addRowsWithStyle ( array $dataRows, Style $style ) : AbstractWriter 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 ) : AbstractWriter Inits the writer and opens it to accept data.
openToFile ( string $outputFilePath ) : AbstractWriter Inits the writer and opens it to accept data.
setDefaultRowStyle ( Style $defaultStyle ) : AbstractWriter Sets the default styles for all rows added with "addRow".
setGlobalFunctionsHelper ( Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper ) : AbstractWriter

보호된 메소드들

메소드 설명
addRowToWriter ( array $dataRow, Style $style ) : void Adds data to the currently openned writer.
closeWriter ( ) : void Closes the streamer, preventing any additional writing.
getDefaultRowStyle ( ) : Style 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.

비공개 메소드들

메소드 설명
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 ( Style $style ) : void Sets the style to be applied to the next written rows until it is changed or reset.

메소드 상세

__construct() 공개 메소드

public __construct ( )

addRow() 공개 메소드

Write given data to the output. New data will be appended to end of stream.
public addRow ( array $dataRow ) : AbstractWriter
$dataRow array Array containing data to be streamed. If empty, no data is added (i.e. not even as a blank row) Example: $dataRow = ['data1', 1234, null, '', 'data5', false];
리턴 AbstractWriter

addRowToWriter() 추상적인 보호된 메소드

Adds data to the currently openned writer.
abstract protected addRowToWriter ( array $dataRow, Style $style ) : void
$dataRow array Array containing data to be streamed. Example $dataRow = ['data1', 1234, null, '', 'data5'];
$style Box\Spout\Writer\Style\Style Style to be applied to the written row
리턴 void

addRowWithStyle() 공개 메소드

Write given data to the output and apply the given style.
또한 보기: addRow
public addRowWithStyle ( array $dataRow, Style $style ) : AbstractWriter
$dataRow array Array of array containing data to be streamed.
$style Box\Spout\Writer\Style\Style Style to be applied to the row.
리턴 AbstractWriter

addRows() 공개 메소드

Write given data to the output. New data will be appended to end of stream.
public addRows ( array $dataRows ) : AbstractWriter
$dataRows array Array of array containing data to be streamed. If a row is empty, it won't be added (i.e. not even as a blank row) Example: $dataRows = [ ['data11', 12, , '', 'data13'], ['data21', 'data22', null, false], ];
리턴 AbstractWriter

addRowsWithStyle() 공개 메소드

Write given data to the output and apply the given style.
또한 보기: addRows
public addRowsWithStyle ( array $dataRows, Style $style ) : AbstractWriter
$dataRows array Array of array containing data to be streamed.
$style Box\Spout\Writer\Style\Style Style to be applied to the rows.
리턴 AbstractWriter

close() 공개 메소드

Closes the writer. This will close the streamer as well, preventing new data to be written to the file.
public close ( ) : void
리턴 void

closeWriter() 추상적인 보호된 메소드

Closes the streamer, preventing any additional writing.
abstract protected closeWriter ( ) : void
리턴 void

getDefaultRowStyle() 보호된 메소드

Can be overriden by children to have a custom style.
protected getDefaultRowStyle ( ) : Style
리턴 Box\Spout\Writer\Style\Style

openToBrowser() 공개 메소드

By using this method, the data will be outputted directly to the browser.
public openToBrowser ( string $outputFileName ) : AbstractWriter
$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
리턴 AbstractWriter

openToFile() 공개 메소드

By using this method, the data will be written to a file.
public openToFile ( string $outputFilePath ) : AbstractWriter
$outputFilePath string Path of the output file that will contain the data
리턴 AbstractWriter

openWriter() 추상적인 보호된 메소드

Opens the streamer and makes it ready to accept data.
abstract protected openWriter ( ) : void
리턴 void

setDefaultRowStyle() 공개 메소드

Overriding the default style instead of using "addRowWithStyle" improves performance by 20%.
또한 보기: https://github.com/box/spout/issues/272
public setDefaultRowStyle ( Style $defaultStyle ) : AbstractWriter
$defaultStyle Box\Spout\Writer\Style\Style
리턴 AbstractWriter

setGlobalFunctionsHelper() 공개 메소드

public setGlobalFunctionsHelper ( Box\Spout\Common\Helper\GlobalFunctionsHelper $globalFunctionsHelper ) : AbstractWriter
$globalFunctionsHelper Box\Spout\Common\Helper\GlobalFunctionsHelper
리턴 AbstractWriter

throwIfFilePointerIsNotAvailable() 보호된 메소드

Will throw an exception if not available.
protected throwIfFilePointerIsNotAvailable ( ) : void
리턴 void

throwIfWriterAlreadyOpened() 보호된 메소드

Throws an exception if already opened.
protected throwIfWriterAlreadyOpened ( string $message ) : void
$message string Error message
리턴 void

프로퍼티 상세

$defaultRowStyle 보호되어 있는 프로퍼티

Default row style. Each writer can have its own default style
protected $defaultRowStyle

$filePointer 보호되어 있는 프로퍼티

Pointer to the file/stream we will write to
protected $filePointer

$globalFunctionsHelper 보호되어 있는 프로퍼티

Helper to work with global functions
protected $globalFunctionsHelper

$headerContentType 보호되어 있는 정적으로 프로퍼티

Content-Type value for the header - to be defined by child class
protected static $headerContentType

$isWriterOpened 보호되어 있는 프로퍼티

Indicates whether the writer has been opened or not
protected $isWriterOpened

$outputFilePath 보호되어 있는 프로퍼티

Path to the output file
protected $outputFilePath

$rowStyle 보호되어 있는 프로퍼티

Style to be applied to the next written row(s)
protected $rowStyle