original_string: public function onSort()
      {
          if ($column = post('sortColumn')) {
  
              /*
               * Toggle the sort direction and set the sorting column
               */
              $sortOptions = ['column' => $this->getSortColumn(), 'direction' => $this->sortDirection];
  
              if ($column != $sortOptions['column'] || $sortOptions['direction'] == 'asc') {
                  $this->sortDirection = $sortOptions['direction'] = 'desc';
              }
              else {
                  $this->sortDirection = $sortOptions['direction'] = 'asc';
              }
  
              $this->sortColumn = $sortOptions['column'] = $column;
  
              $this->putSession('sort', $sortOptions);
  
              /*
               * Persist the page number
               */
              $this->currentPageNumber = post('page');
  
              return $this->onRefresh();
          }
      }
code: public function onSort()
      {
          if ($column = post('sortColumn')) {
  
              /*
               * Toggle the sort direction and set the sorting column
               */
              $sortOptions = ['column' => $this->getSortColumn(), 'direction' => $this->sortDirection];
  
              if ($column != $sortOptions['column'] || $sortOptions['direction'] == 'asc') {
                  $this->sortDirection = $sortOptions['direction'] = 'desc';
              }
              else {
                  $this->sortDirection = $sortOptions['direction'] = 'asc';
              }
  
              $this->sortColumn = $sortOptions['column'] = $column;
  
              $this->putSession('sort', $sortOptions);
  
              /*
               * Persist the page number
               */
              $this->currentPageNumber = post('page');
  
              return $this->onRefresh();
          }
      }
code_tokens: public function onSort ( ) { if ( $ column = post ( 'sortColumn' ) ) { /*
               * Toggle the sort direction and set the sorting column
               */ $ sortOptions = [ 'column' => $ this -> getSortColumn ( ) , 'direction' => $ this -> sortDirection ] ; if ( $ column != $ sortOptions [ 'column' ] || $ sortOptions [ 'direction' ] == 'asc' ) { $ this -> sortDirection = $ sortOptions [ 'direction' ] = 'desc' ; } else { $ this -> sortDirection = $ sortOptions [ 'direction' ] = 'asc' ; } $ this -> sortColumn = $ sortOptions [ 'column' ] = $ column ; $ this -> putSession ( 'sort' , $ sortOptions ) ; /*
               * Persist the page number
               */ $ this -> currentPageNumber = post ( 'page' ) ; return $ this -> onRefresh ( ) ; } }
docstring: Event handler for sorting the list.
docstring_tokens: Event handler for sorting the list .