public static function reorderInvoicesByAge($invoices)
    {
        $invoicesByAge    = [];
        $invoicesByAgeRaw = [];
        foreach ($invoices as $invoiceData) {
            $invoicesByAgeRaw[\FlexiPeeHP\FlexiBeeRW::flexiDateToDateTime($invoiceData['datVyst'])->getTimestamp()]
                = $invoiceData;
        }
        ksort($invoicesByAgeRaw);
        foreach ($invoicesByAgeRaw as $invoiceData) {
            $invoicesByAge[$invoiceData['kod']] = $invoiceData;
        }
        return $invoicesByAge;
    }
public static function reorderInvoicesByAge($invoices)
    {
        $invoicesByAge    = [];
        $invoicesByAgeRaw = [];
        foreach ($invoices as $invoiceData) {
            $invoicesByAgeRaw[\FlexiPeeHP\FlexiBeeRW::flexiDateToDateTime($invoiceData['datVyst'])->getTimestamp()]
                = $invoiceData;
        }
        ksort($invoicesByAgeRaw);
        foreach ($invoicesByAgeRaw as $invoiceData) {
            $invoicesByAge[$invoiceData['kod']] = $invoiceData;
        }
        return $invoicesByAge;
    }
public static function reorderInvoicesByAge ( $ invoices ) { $ invoicesByAge = [ ] ; $ invoicesByAgeRaw = [ ] ; foreach ( $ invoices as $ invoiceData ) { $ invoicesByAgeRaw [ \ FlexiPeeHP \ FlexiBeeRW :: flexiDateToDateTime ( $ invoiceData [ 'datVyst' ] ) -> getTimestamp ( ) ] = $ invoiceData ; } ksort ( $ invoicesByAgeRaw ) ; foreach ( $ invoicesByAgeRaw as $ invoiceData ) { $ invoicesByAge [ $ invoiceData [ 'kod' ] ] = $ invoiceData ; } return $ invoicesByAge ; }
Reorder invoices by Age.

@param array $invoices

@return array Older First sorted invoices
Reorder invoices by Age .