protected function sortData() {
        $columns = $this->getOrder();
        $order = [];
        foreach ($columns as $column) {
            if ($column[0] === '-') {
                $column = substr($column, 1);
                $order[$column] = -1;
            } else {
                $order[$column] = 1;
            }
        }

        $cmp = function ($a, $b) use ($order) {
            foreach ($order as $column => $desc) {
                $r = strnatcmp($a[$column], $b[$column]);

                if ($r !== 0) {
                    return $r * $desc;
                }
            }
            return 0;
        };

        usort($this->data, $cmp);
    }
protected function sortData() {
        $columns = $this->getOrder();
        $order = [];
        foreach ($columns as $column) {
            if ($column[0] === '-') {
                $column = substr($column, 1);
                $order[$column] = -1;
            } else {
                $order[$column] = 1;
            }
        }

        $cmp = function ($a, $b) use ($order) {
            foreach ($order as $column => $desc) {
                $r = strnatcmp($a[$column], $b[$column]);

                if ($r !== 0) {
                    return $r * $desc;
                }
            }
            return 0;
        };

        usort($this->data, $cmp);
    }
protected function sortData ( ) { $ columns = $ this -> getOrder ( ) ; $ order = [ ] ; foreach ( $ columns as $ column ) { if ( $ column [ 0 ] === '-' ) { $ column = substr ( $ column , 1 ) ; $ order [ $ column ] = - 1 ; } else { $ order [ $ column ] = 1 ; } } $ cmp = function ( $ a , $ b ) use ( $ order ) { foreach ( $ order as $ column => $ desc ) { $ r = strnatcmp ( $ a [ $ column ] , $ b [ $ column ] ) ; if ( $ r !== 0 ) { return $ r * $ desc ; } } return 0 ; } ; usort ( $ this -> data , $ cmp ) ; }
Sort the internal array.
Sort the internal array .