\PhpOffice\PhpSpreadsheet\HelperSample

Helper class to be used in sample code.

Summary

Methods
Properties
Constants
isCli()
getScriptFilename()
isIndex()
getPageTitle()
getPageHeading()
getSamples()
write()
getFilename()
getTemporaryFilename()
log()
logEndingNotes()
logWrite()
logRead()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getTemporaryFolder()
No private properties found
N/A

Methods

isCli()

isCli() : bool

Returns whether we run on CLI or browser.

Returns

bool —

getScriptFilename()

getScriptFilename() : string

Return the filename currently being executed.

Returns

string —

isIndex()

isIndex() : bool

Whether we are executing the index page.

Returns

bool —

getPageTitle()

getPageTitle() : string

Return the page title.

Returns

string —

getPageHeading()

getPageHeading() : string

Return the page heading.

Returns

string —

getSamples()

getSamples() : string[]

Returns an array of all known samples.

Returns

string[] —

[$name => $path]

write()

write(\PhpOffice\PhpSpreadsheet\Spreadsheet  $spreadsheet, string  $filename, string[]  $writers = ['Xlsx', 'Xls']) : void

Write documents.

Parameters

\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet
string $filename
string[] $writers

getFilename()

getFilename(string  $filename, string  $extension = 'xlsx') : string

Returns the filename that should be used for sample output.

Parameters

string $filename
string $extension

Returns

string —

getTemporaryFilename()

getTemporaryFilename(string  $extension = 'xlsx') : string

Return a random temporary file name.

Parameters

string $extension

Returns

string —

log()

log(mixed  $message) : void

Parameters

mixed $message

logEndingNotes()

logEndingNotes() : void

Log ending notes.

logWrite()

logWrite(\PhpOffice\PhpSpreadsheet\Writer\IWriter  $writer, string  $path, float  $callStartTime) : void

Log a line about the write operation.

Parameters

\PhpOffice\PhpSpreadsheet\Writer\IWriter $writer
string $path
float $callStartTime

logRead()

logRead(string  $format, string  $path, float  $callStartTime) : void

Log a line about the read operation.

Parameters

string $format
string $path
float $callStartTime

getTemporaryFolder()

getTemporaryFolder() : string

Returns the temporary directory and make sure it exists.

Returns

string —