private function applyOrders(array $settings): void
    {
        $data = $this->getSource();
        // Create empty column stack
        $orders = [];
        foreach ($settings as $column => $order) {
            $orders[$column] = [];
        }

        // Obtain a list of columns
        foreach ($data as $key => $row) {
            foreach ($settings as $column => $order) {
                $orders[$column][$key] = $row[$column];
            }
        }

        // Prepare array of arguments
        $funcArgs = [];
        foreach ($settings as $column => $order) {
            $funcArgs[] = $orders[$column];
            $funcArgs[] = ($order === Grid\Grid::ORDER_ASC) ? SORT_ASC : SORT_DESC;
        }
        $funcArgs[] = &$data;

        // Sort the data with volume descending, edition ascending
        // Add $data as the last parameter, to sort by the common key
        array_multisort(...$funcArgs);
        $this->setSource($data);
    }
private function applyOrders(array $settings): void
    {
        $data = $this->getSource();
        // Create empty column stack
        $orders = [];
        foreach ($settings as $column => $order) {
            $orders[$column] = [];
        }

        // Obtain a list of columns
        foreach ($data as $key => $row) {
            foreach ($settings as $column => $order) {
                $orders[$column][$key] = $row[$column];
            }
        }

        // Prepare array of arguments
        $funcArgs = [];
        foreach ($settings as $column => $order) {
            $funcArgs[] = $orders[$column];
            $funcArgs[] = ($order === Grid\Grid::ORDER_ASC) ? SORT_ASC : SORT_DESC;
        }
        $funcArgs[] = &$data;

        // Sort the data with volume descending, edition ascending
        // Add $data as the last parameter, to sort by the common key
        array_multisort(...$funcArgs);
        $this->setSource($data);
    }
private function applyOrders ( array $ settings ) : void { $ data = $ this -> getSource ( ) ; // Create empty column stack $ orders = [ ] ; foreach ( $ settings as $ column => $ order ) { $ orders [ $ column ] = [ ] ; } // Obtain a list of columns foreach ( $ data as $ key => $ row ) { foreach ( $ settings as $ column => $ order ) { $ orders [ $ column ] [ $ key ] = $ row [ $ column ] ; } } // Prepare array of arguments $ funcArgs = [ ] ; foreach ( $ settings as $ column => $ order ) { $ funcArgs [ ] = $ orders [ $ column ] ; $ funcArgs [ ] = ( $ order === Grid \ Grid :: ORDER_ASC ) ? SORT_ASC : SORT_DESC ; } $ funcArgs [ ] = & $ data ; // Sort the data with volume descending, edition ascending // Add $data as the last parameter, to sort by the common key array_multisort ( ... $ funcArgs ) ; $ this -> setSource ( $ data ) ; }
Apply order to array

@param  array $settings

@return void
@throws Grid\GridException
Apply order to array