protected function buildInvoiceList(IM\InvoiceSubjectInterface $subject)
    {
        $invoices = $subject->getInvoices(true)->toArray();

        usort($invoices, function (IM\InvoiceInterface $a, IM\InvoiceInterface $b) {
            return $a->getCreatedAt()->getTimestamp() - $b->getCreatedAt()->getTimestamp();
        });

        return array_map(function (IM\InvoiceInterface $invoice) {
            return [
                'invoice' => $invoice,
                'total'   => $invoice->getGrandTotal(),
            ];
        }, $invoices);
    }
protected function buildInvoiceList(IM\InvoiceSubjectInterface $subject)
    {
        $invoices = $subject->getInvoices(true)->toArray();

        usort($invoices, function (IM\InvoiceInterface $a, IM\InvoiceInterface $b) {
            return $a->getCreatedAt()->getTimestamp() - $b->getCreatedAt()->getTimestamp();
        });

        return array_map(function (IM\InvoiceInterface $invoice) {
            return [
                'invoice' => $invoice,
                'total'   => $invoice->getGrandTotal(),
            ];
        }, $invoices);
    }
protected function buildInvoiceList ( IM \ InvoiceSubjectInterface $ subject ) { $ invoices = $ subject -> getInvoices ( true ) -> toArray ( ) ; usort ( $ invoices , function ( IM \ InvoiceInterface $ a , IM \ InvoiceInterface $ b ) { return $ a -> getCreatedAt ( ) -> getTimestamp ( ) - $ b -> getCreatedAt ( ) -> getTimestamp ( ) ; } ) ; return array_map ( function ( IM \ InvoiceInterface $ invoice ) { return [ 'invoice' => $ invoice , 'total' => $ invoice -> getGrandTotal ( ) , ] ; } , $ invoices ) ; }
Builds the sale invoices list.

@param IM\InvoiceSubjectInterface $subject

@return array
Builds the sale invoices list .