class ReportGenerator

Properties

Collection $options

Options for this report.

string $name

Name of the report for use in text.

string $filename

Name of the report for use as (part of) a filename.

string $extension

File extension of the report file.

protected mixed $source

Source this report belongs to (e.g. a volume).

protected array $tmpFiles

Temporary files that are created when generating a report.

protected Collection $labels

Cache for labels of all label trees that are used for this report.

Methods

static ReportGenerator
get(string $sourceClass, ReportType $type, array $options = [])

Get the report generator for the given type.

__construct(array $options = [])

Create a report generator instance.

string
generate(mixed $source)

Generate the report.

generateReport(string $path)

Internal function to generate the report.

setSource(mixed $source)

Set the source.

string
getName()

Get the report name.

string
getFilename()

Get the report filename.

string
getFullFilename()

Get the filename with extension.

string
expandLabelName(int $id)

Constructs a label name from the names of all parent labels and the label itself.

Collection
getSiblingLabels(int $id)

Get all labels that belong to the label tree of the given label.

bool
shouldSeparateLabelTrees()

Should this report separate the output files for different label trees?

bool
shouldSeparateUsers()

Should this report separate the output files for different user?

array
getOnlyLabels()

Returns the array of label ids to which this report should be restricted.

bool
isRestrictedToLabels()

Determines if this report is restricted to a subset of labels.

Details

at line 75
static ReportGenerator get(string $sourceClass, ReportType $type, array $options = [])

Get the report generator for the given type.

Parameters

string $sourceClass

Class name of the source model

ReportType $type

Type of the report to generate

array $options

Options for the report generator

Return Value

ReportGenerator

at line 103
__construct(array $options = [])

Create a report generator instance.

Parameters

array $options

Options for the report

at line 116
string generate(mixed $source)

Generate the report.

Parameters

mixed $source

Source to generate the report for (e.g. a volume)

Return Value

string

Path to the generated report file.

at line 153
generateReport(string $path)

Internal function to generate the report.

(public for better testability)

Parameters

string $path

Path to write the report file to.

at line 163
setSource(mixed $source)

Set the source.

Parameters

mixed $source

at line 173
string getName()

Get the report name.

Return Value

string

at line 183
string getFilename()

Get the report filename.

Return Value

string

at line 193
string getFullFilename()

Get the filename with extension.

Return Value

string

at line 206
string expandLabelName(int $id)

Constructs a label name from the names of all parent labels and the label itself.

Example: Animalia > Annelida > Polychaeta > Buskiella sp

Parameters

int $id

Label ID

Return Value

string

at line 237
protected Collection getSiblingLabels(int $id)

Get all labels that belong to the label tree of the given label.

Parameters

int $id

Label ID

Return Value

Collection

at line 253
protected bool shouldSeparateLabelTrees()

Should this report separate the output files for different label trees?

Return Value

bool

at line 263
protected bool shouldSeparateUsers()

Should this report separate the output files for different user?

Return Value

bool

at line 273
protected array getOnlyLabels()

Returns the array of label ids to which this report should be restricted.

Return Value

array

at line 283
protected bool isRestrictedToLabels()

Determines if this report is restricted to a subset of labels.

Return Value

bool