original_string: protected function _setupSort()
      {
          if (!($this->_sortEnabled = $this->_isSortEnabled())) {
              return;
          }
  
          $this->sortFields = $this->_getSortFields();
  
          foreach ($this->sortFields as $field => $options) {
              if (!isset($options['default'])) {
                  continue;
              }
              $dir = strtolower($options['default']);
              if (in_array($dir, ['asc', 'desc'])) {
                  $this->defaultSort = [
                      'field' => $field,
                      'dir' => $dir
                  ];
              }
          }
      }
code: protected function _setupSort()
      {
          if (!($this->_sortEnabled = $this->_isSortEnabled())) {
              return;
          }
  
          $this->sortFields = $this->_getSortFields();
  
          foreach ($this->sortFields as $field => $options) {
              if (!isset($options['default'])) {
                  continue;
              }
              $dir = strtolower($options['default']);
              if (in_array($dir, ['asc', 'desc'])) {
                  $this->defaultSort = [
                      'field' => $field,
                      'dir' => $dir
                  ];
              }
          }
      }
code_tokens: protected function _setupSort ( ) { if ( ! ( $ this -> _sortEnabled = $ this -> _isSortEnabled ( ) ) ) { return ; } $ this -> sortFields = $ this -> _getSortFields ( ) ; foreach ( $ this -> sortFields as $ field => $ options ) { if ( ! isset ( $ options [ 'default' ] ) ) { continue ; } $ dir = strtolower ( $ options [ 'default' ] ) ; if ( in_array ( $ dir , [ 'asc' , 'desc' ] ) ) { $ this -> defaultSort = [ 'field' => $ field , 'dir' => $ dir ] ; } } }
docstring: Setup default sort options.
  
  @return void
docstring_tokens: Setup default sort options .