RenderedInvoice
in package
Result of a render run. With several formats, every format is reachable via {@see self::as()}; all share the same calculation.
Table of Contents
Methods
- __construct() : mixed
- as() : self
- The result for another format of the same run.
- contents() : string
- The main output: PDF, otherwise XML, HTML or JSON.
- data() : InvoiceData
- The calculated invoice data of the run (totals, VAT breakdown, due date).
- extension() : string
- Extension of the main output (contents()): pdf, xml, html or json.
- filename() : string
- File name of the main output, from the configured pattern; $extension replaces the extension of the main output.
- format() : string
- Key of the format of this result, e.g. "zugferd".
- formats() : array<int, string>
- hashes() : array<string, string>
- SHA-256 hashes of the outputs, e.g. for archiving.
- hasPdf() : bool
- Whether this format produced a PDF.
- hasXml() : bool
- Whether this format produced XML (also the XML embedded in a PDF).
- html() : string
- The rendered template, as mPDF received it.
- json() : string
- The invoice as JSON (InvoiceData::toJson()).
- mimeType() : string
- MIME type of the main output (contents()).
- pdf() : string
- The PDF.
- profile() : Profile|null
- Profile of the XML; null for formats without XML.
- save() : string
- Writes the main output. A directory as target uses {@see self::filename()}.
- validation() : ValidationResult
- Validation result of this format; in the mode "warn" it may contain errors, empty in the mode "off".
- xml() : string
- The e-invoice XML, also the one embedded in the PDF.
Methods
__construct()
public
__construct(InvoiceData $data, string $format, Profile|null $profile, ValidationResult $validation, string $filenamePattern[, string|null $xml = null ][, string|null $pdf = null ][, string|null $html = null ][, string|null $json = null ]) : mixed
Parameters
- $data : InvoiceData
- $format : string
- $profile : Profile|null
- $validation : ValidationResult
- $filenamePattern : string
-
file name with the placeholder {ext}
- $xml : string|null = null
- $pdf : string|null = null
- $html : string|null = null
- $json : string|null = null
as()
The result for another format of the same run.
public
as(string $format) : self
Parameters
- $format : string
Return values
selfcontents()
The main output: PDF, otherwise XML, HTML or JSON.
public
contents() : string
Return values
stringdata()
The calculated invoice data of the run (totals, VAT breakdown, due date).
public
data() : InvoiceData
Return values
InvoiceDataextension()
Extension of the main output (contents()): pdf, xml, html or json.
public
extension() : string
Return values
stringfilename()
File name of the main output, from the configured pattern; $extension replaces the extension of the main output.
public
filename([string|null $extension = null ]) : string
Parameters
- $extension : string|null = null
Return values
stringformat()
Key of the format of this result, e.g. "zugferd".
public
format() : string
Return values
stringformats()
public
formats() : array<int, string>
Return values
array<int, string>hashes()
SHA-256 hashes of the outputs, e.g. for archiving.
public
hashes() : array<string, string>
Return values
array<string, string>hasPdf()
Whether this format produced a PDF.
public
hasPdf() : bool
Return values
boolhasXml()
Whether this format produced XML (also the XML embedded in a PDF).
public
hasXml() : bool
Return values
boolhtml()
The rendered template, as mPDF received it.
public
html() : string
Tags
Return values
stringjson()
The invoice as JSON (InvoiceData::toJson()).
public
json() : string
Return values
stringmimeType()
MIME type of the main output (contents()).
public
mimeType() : string
Return values
stringpdf()
The PDF.
public
pdf() : string
Tags
Return values
stringprofile()
Profile of the XML; null for formats without XML.
public
profile() : Profile|null
Return values
Profile|nullsave()
Writes the main output. A directory as target uses {@see self::filename()}.
public
save(string $path) : string
Parameters
- $path : string
Return values
string —the written path
validation()
Validation result of this format; in the mode "warn" it may contain errors, empty in the mode "off".
public
validation() : ValidationResult
Return values
ValidationResultxml()
The e-invoice XML, also the one embedded in the PDF.
public
xml() : string