Sample
in package
Helper class to be used in sample code.
Table of Contents
Methods
- displayGrid() : void
- getFilename() : string
- Returns the filename that should be used for sample output.
- getPageHeading() : string
- Return the page heading.
- getPageTitle() : string
- Return the page title.
- getSamples() : array<string|int, array<string|int, string>>
- Returns an array of all known samples.
- getScriptFilename() : string
- Return the filename currently being executed.
- getTemporaryFilename() : string
- Return a random temporary file name.
- getTemporaryFolder() : string
- Returns the temporary directory and make sure it exists.
- isCli() : bool
- Returns whether we run on CLI or browser.
- isIndex() : bool
- Whether we are executing the index page.
- log() : void
- logCalculationResult() : void
- logEndingNotes() : void
- Log ending notes.
- logRead() : void
- Log a line about the read operation.
- logWrite() : void
- Log a line about the write operation.
- renderChart() : void
- Render chart as part of running chart samples in browser.
- titles() : void
- write() : void
- Write documents.
- isDirOrMkdir() : bool
Methods
displayGrid()
public
displayGrid(array<string|int, mixed> $matrix) : void
Parameters
- $matrix : array<string|int, mixed>
getFilename()
Returns the filename that should be used for sample output.
public
getFilename(string $filename[, string $extension = 'xlsx' ]) : string
Parameters
- $filename : string
- $extension : string = 'xlsx'
Return values
stringgetPageHeading()
Return the page heading.
public
getPageHeading() : string
Return values
stringgetPageTitle()
Return the page title.
public
getPageTitle() : string
Return values
stringgetSamples()
Returns an array of all known samples.
public
getSamples() : array<string|int, array<string|int, string>>
Return values
array<string|int, array<string|int, string>> —[$name => $path]
getScriptFilename()
Return the filename currently being executed.
public
getScriptFilename() : string
Return values
stringgetTemporaryFilename()
Return a random temporary file name.
public
getTemporaryFilename([string $extension = 'xlsx' ]) : string
Parameters
- $extension : string = 'xlsx'
Return values
stringgetTemporaryFolder()
Returns the temporary directory and make sure it exists.
public
getTemporaryFolder() : string
Return values
stringisCli()
Returns whether we run on CLI or browser.
public
isCli() : bool
Return values
boolisIndex()
Whether we are executing the index page.
public
isIndex() : bool
Return values
boollog()
public
log(string $message) : void
Parameters
- $message : string
logCalculationResult()
public
logCalculationResult(Worksheet $worksheet, string $functionName, string $formulaCell[, string|null $descriptionCell = null ]) : void
Parameters
- $worksheet : Worksheet
- $functionName : string
- $formulaCell : string
- $descriptionCell : string|null = null
logEndingNotes()
Log ending notes.
public
logEndingNotes() : void
logRead()
Log a line about the read operation.
public
logRead(string $format, string $path, float $callStartTime) : void
Parameters
- $format : string
- $path : string
- $callStartTime : float
logWrite()
Log a line about the write operation.
public
logWrite(IWriter $writer, string $path, float $callStartTime) : void
Parameters
- $writer : IWriter
- $path : string
- $callStartTime : float
renderChart()
Render chart as part of running chart samples in browser.
public
renderChart(Chart $chart, string $fileName[, Spreadsheet|null $spreadsheet = null ]) : void
Charts are not rendered in unit tests, which are command line.
Parameters
- $chart : Chart
- $fileName : string
- $spreadsheet : Spreadsheet|null = null
Tags
titles()
public
titles(string $category, string $functionName[, string|null $description = null ]) : void
Parameters
- $category : string
- $functionName : string
- $description : string|null = null
write()
Write documents.
public
write(Spreadsheet $spreadsheet, string $filename[, array<string|int, string> $writers = ['Xlsx', 'Xls'] ][, bool $withCharts = false ][, callable|null $writerCallback = null ][, bool $resetActiveSheet = true ]) : void
Parameters
- $spreadsheet : Spreadsheet
- $filename : string
- $writers : array<string|int, string> = ['Xlsx', 'Xls']
- $withCharts : bool = false
- $writerCallback : callable|null = null
- $resetActiveSheet : bool = true
isDirOrMkdir()
protected
isDirOrMkdir(string $folder) : bool
Parameters
- $folder : string