original_string: public function getSecondaryColumnToSort(Row $row, $primaryColumnToSort)
      {
          $defaultSecondaryColumn = array(Metrics::INDEX_NB_VISITS, 'nb_visits');
  
          if (in_array($primaryColumnToSort, $defaultSecondaryColumn)) {
              // if sorted by visits, then sort by label as a secondary column
              $column = 'label';
              $value  = $row->hasColumn($column);
              if ($value !== false) {
                  return $column;
              }
  
              return null;
          }
  
          if ($primaryColumnToSort !== 'label') {
              // we do not add this by default to make sure we do not sort by label as a first and secondary column
              $defaultSecondaryColumn[] = 'label';
          }
  
          foreach ($defaultSecondaryColumn as $column) {
              $value = $row->hasColumn($column);
              if ($value !== false) {
                  return $column;
              }
          }
      }
code: public function getSecondaryColumnToSort(Row $row, $primaryColumnToSort)
      {
          $defaultSecondaryColumn = array(Metrics::INDEX_NB_VISITS, 'nb_visits');
  
          if (in_array($primaryColumnToSort, $defaultSecondaryColumn)) {
              // if sorted by visits, then sort by label as a secondary column
              $column = 'label';
              $value  = $row->hasColumn($column);
              if ($value !== false) {
                  return $column;
              }
  
              return null;
          }
  
          if ($primaryColumnToSort !== 'label') {
              // we do not add this by default to make sure we do not sort by label as a first and secondary column
              $defaultSecondaryColumn[] = 'label';
          }
  
          foreach ($defaultSecondaryColumn as $column) {
              $value = $row->hasColumn($column);
              if ($value !== false) {
                  return $column;
              }
          }
      }
code_tokens: public function getSecondaryColumnToSort ( Row $ row , $ primaryColumnToSort ) { $ defaultSecondaryColumn = array ( Metrics :: INDEX_NB_VISITS , 'nb_visits' ) ; if ( in_array ( $ primaryColumnToSort , $ defaultSecondaryColumn ) ) { // if sorted by visits, then sort by label as a secondary column $ column = 'label' ; $ value = $ row -> hasColumn ( $ column ) ; if ( $ value !== false ) { return $ column ; } return null ; } if ( $ primaryColumnToSort !== 'label' ) { // we do not add this by default to make sure we do not sort by label as a first and secondary column $ defaultSecondaryColumn [ ] = 'label' ; } foreach ( $ defaultSecondaryColumn as $ column ) { $ value = $ row -> hasColumn ( $ column ) ; if ( $ value !== false ) { return $ column ; } } }
docstring: Detect the secondary sort column to be used for sorting
  
  @param Row $row
  @param int|string $primaryColumnToSort
  @return int
docstring_tokens: Detect the secondary sort column to be used for sorting