InvoiceFormat
Abstract class that all Invoice Formats must extend
Attributes
- #[AllowDynamicProperties]
Table of Contents
Properties
| $config | |
| $content | |
| $currency_format | |
| $invoice |
Methods
| __construct() | Constructor - loads the config.json for this format |
| download() | Outputs the Invoice format to stdout, sending the appropriate headers to force a download |
| fetch() | Returns the invoice format content in the desired format |
| generateFormat() | Generates the electronic invoice format This method must be implemented by each format |
| getAuthors() | Returns the name and URL for the authors of this invoice format |
| getDescription() | Returns the description of this invoice format |
| getFileExtension() | Returns the file extension for this format |
| getMimeType() | Returns the MIME type for this format |
| getName() | Returns the name of this invoice format |
| getVersion() | Returns the version of this invoice format |
| setCurrency() | Sets the CurrencyFormat object for formatting currency values |
| setInvoiceId() | Sets the invoice ID and loads the invoice data |
| stream() | Outputs the Invoice format to stdout, sending the appropriate headers to render the document inline |
| loadConfig() | Loads the config.json file for this format |
Properties
$config
protected
array<string|int, mixed>
$config
= []
The config data for this format
$content
protected
string
$content
The generated format content
$currency_format
protected
CurrencyFormat
$currency_format
The CurrencyFormat object for formatting currency values
$invoice
protected
stdClass
$invoice
The invoice data
Methods
__construct()
Constructor - loads the config.json for this format
public
__construct() : mixed
download()
Outputs the Invoice format to stdout, sending the appropriate headers to force a download
public
download([string $name = null ]) : mixed
Parameters
- $name : string = null
-
The name of the document minus the extension (optional)
fetch()
Returns the invoice format content in the desired format
public
fetch() : string
Return values
string —The document content
generateFormat()
Generates the electronic invoice format This method must be implemented by each format
public
abstract generateFormat() : mixed
getAuthors()
Returns the name and URL for the authors of this invoice format
public
getAuthors() : array<string|int, mixed>
Return values
array<string|int, mixed> —The name and URL of the authors of this format
getDescription()
Returns the description of this invoice format
public
getDescription() : string
Return values
string —The name of this format
getFileExtension()
Returns the file extension for this format
public
getFileExtension() : string
Return values
string —The file extension
getMimeType()
Returns the MIME type for this format
public
getMimeType() : string
Return values
string —The MIME type
getName()
Returns the name of this invoice format
public
getName() : string
Return values
string —The name of this format
getVersion()
Returns the version of this invoice format
public
getVersion() : string
Return values
string —The current version of this format
setCurrency()
Sets the CurrencyFormat object for formatting currency values
public
setCurrency(CurrencyFormat $currency_format) : mixed
Parameters
- $currency_format : CurrencyFormat
-
The CurrencyFormat object
setInvoiceId()
Sets the invoice ID and loads the invoice data
public
setInvoiceId(int $invoice_id) : mixed
Parameters
- $invoice_id : int
-
The invoice ID
stream()
Outputs the Invoice format to stdout, sending the appropriate headers to render the document inline
public
stream([string $name = null ]) : mixed
Parameters
- $name : string = null
-
The name of the document minus the extension (optional)
loadConfig()
Loads the config.json file for this format
private
loadConfig() : mixed