class Sample (View source)

Helper class to be used in sample code.

Methods

bool
isCli()

Returns whether we run on CLI or browser.

string
getScriptFilename()

Return the filename currently being executed.

bool
isIndex()

Whether we are executing the index page.

string
getPageTitle()

Return the page title.

string
getPageHeading()

Return the page heading.

string[]
getSamples()

Returns an array of all known samples.

write(Spreadsheet $spreadsheet, string $filename, array $writers = ['Xlsx', 'Xls'])

Write documents.

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

Returns the filename that should be used for sample output.

string
getTemporaryFilename(string $extension = 'xlsx')

Return a random temporary file name.

log($message)

No description

logEndingNotes()

Log ending notes.

logWrite(IWriter $writer, string $path, float $callStartTime)

Log a line about the write operation.

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

Log a line about the read operation.

Details

bool isCli()

Returns whether we run on CLI or browser.

Return Value

bool

string getScriptFilename()

Return the filename currently being executed.

Return Value

string

bool isIndex()

Whether we are executing the index page.

Return Value

bool

string getPageTitle()

Return the page title.

Return Value

string

string getPageHeading()

Return the page heading.

Return Value

string

string[] getSamples()

Returns an array of all known samples.

Return Value

string[] [$name => $path]

write(Spreadsheet $spreadsheet, string $filename, array $writers = ['Xlsx', 'Xls'])

Write documents.

Parameters

Spreadsheet $spreadsheet
string $filename
array $writers

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

Returns the filename that should be used for sample output.

Parameters

string $filename
string $extension

Return Value

string

string getTemporaryFilename(string $extension = 'xlsx')

Return a random temporary file name.

Parameters

string $extension

Return Value

string

log($message)

Parameters

$message

logEndingNotes()

Log ending notes.

logWrite(IWriter $writer, string $path, float $callStartTime)

Log a line about the write operation.

Parameters

IWriter $writer
string $path
float $callStartTime

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

Log a line about the read operation.

Parameters

string $format
string $path
float $callStartTime