/** * * @param int $id * @return InvoiceSendResponse * @throws IfirmaException */ public static function get($id) { $invoice = new InvoiceSendResponse(); $invoice->disableSendMethod(); ConnectorAbstract::factory($invoice)->receive($id); return $invoice; }
/** * * @param int $id * @return InvoiceSendResponse * @throws IfirmaException */ public static function get($id) { require_once dirname(__FILE__) . '/InvoiceSendResponse.php'; $invoice = new InvoiceSendResponse(); $invoice->disableSendMethod(); ConnectorAbstract::factory($invoice)->receive($id); return $invoice; }
/** * * @param \ifirma\InvoiceAbstract $invoice * @throws IfirmaException * @return ConnectorAbstract */ private static function _getInvoiceConnectorTypeBasedOnInvoice(InvoiceAbstract $invoice) { require_once dirname(__FILE__) . '/../Invoice/Invoice.php'; require_once dirname(__FILE__) . '/../Invoice/InvoiceSend.php'; require_once dirname(__FILE__) . '/../Invoice/InvoiceBill.php'; require_once dirname(__FILE__) . '/../Invoice/InvoiceProforma.php'; $invoiceType = get_class($invoice); switch ($invoiceType) { case Invoice::getType(): case InvoiceResponse::getType(): return new ConnectorInvoice(); break; case InvoiceBill::getType(): case InvoiceBillResponse::getType(): return new ConnectorInvoiceBill(); break; case InvoiceProforma::getType(): case InvoiceProformaResponse::getType(): return new ConnectorInvoiceProforma(); break; case InvoiceSend::getType(): case InvoiceSendResponse::getType(): return new ConnectorInvoiceSend(); break; default: throw new IfirmaException(sprintf("Unsupported invoice type: %s", $invoiceType)); break; } }