src/Jsonq.php
public function sortBy($column, $order = 'asc')
    {
        $this->prepare();

        if (!is_array($this->_map)) {
            return $this;
        }

        usort($this->_map, function ($a, $b) use ($column, $order) {
            $val1 = $this->getFromNested($a, $column);
            $val2 = $this->getFromNested($b, $column);
            if (is_string($val1)) {
                $val1 = strtolower($val1);
            }

            if (is_string($val2)) {
                $val2 = strtolower($val2);
            }

            if ($val1 == $val2) {
                return 0;
            }
            $order = strtolower(trim($order));

            if ($order == 'desc') {
                return ($val1 > $val2) ? -1 : 1;
            } else {
                return ($val1 < $val2) ? -1 : 1;
            }
        });

        return $this;
    }
public function sortBy($column, $order = 'asc')
    {
        $this->prepare();

        if (!is_array($this->_map)) {
            return $this;
        }

        usort($this->_map, function ($a, $b) use ($column, $order) {
            $val1 = $this->getFromNested($a, $column);
            $val2 = $this->getFromNested($b, $column);
            if (is_string($val1)) {
                $val1 = strtolower($val1);
            }

            if (is_string($val2)) {
                $val2 = strtolower($val2);
            }

            if ($val1 == $val2) {
                return 0;
            }
            $order = strtolower(trim($order));

            if ($order == 'desc') {
                return ($val1 > $val2) ? -1 : 1;
            } else {
                return ($val1 < $val2) ? -1 : 1;
            }
        });

        return $this;
    }
public function sortBy ( $ column , $ order = 'asc' ) { $ this -> prepare ( ) ; if ( ! is_array ( $ this -> _map ) ) { return $ this ; } usort ( $ this -> _map , function ( $ a , $ b ) use ( $ column , $ order ) { $ val1 = $ this -> getFromNested ( $ a , $ column ) ; $ val2 = $ this -> getFromNested ( $ b , $ column ) ; if ( is_string ( $ val1 ) ) { $ val1 = strtolower ( $ val1 ) ; } if ( is_string ( $ val2 ) ) { $ val2 = strtolower ( $ val2 ) ; } if ( $ val1 == $ val2 ) { return 0 ; } $ order = strtolower ( trim ( $ order ) ) ; if ( $ order == 'desc' ) { return ( $ val1 > $ val2 ) ? - 1 : 1 ; } else { return ( $ val1 < $ val2 ) ? - 1 : 1 ; } } ) ; return $ this ; }
sorting from prepared data

@param string $column
@param string $order
@return object|array|null
@throws ConditionNotAllowedException
sorting from prepared data