I am just about to write a method to convert some billing data into an invoice.
So say i have and an array of objects that contain the data necessary to create the invocie items.
While in the billing controller Which of the following way is correct
$invoice = new Invoice();
$invoice->createInvoiceFromBilling($billingItems);
Then in the Invoice Class
Public Function createInvoiceFromBilling($billingItems)
{
$this->data = $billingItems;
OR
Invoice::createInvoiceFromBilling($billingItems)
Then in the Invoice Class
Public Function createInvoiceFromBilling($billingItems)
{
$invoice = new Invoice();
$invoice->data = $billingItems;
Which way is the correct way?
Regards
$invoice = $invoceFactory->createFromBilling( $billingItems );