original_string: protected function sortList(array &$list, array $allowed, array $query, array $default = array())
      {
          if (empty($default)) {
              $default = array('sort' => '', 'order' => '');
          } else {
              $order = reset($default);
              $field = key($default);
              $default = array('sort' => $field, 'order' => $order);
          }
  
          $query += $default;
  
          if (in_array($query['sort'], $allowed)) {
              uasort($list, function ($a, $b) use ($query) {
                  return $this->callbackSortList($a, $b, $query);
              });
          }
      }
code: protected function sortList(array &$list, array $allowed, array $query, array $default = array())
      {
          if (empty($default)) {
              $default = array('sort' => '', 'order' => '');
          } else {
              $order = reset($default);
              $field = key($default);
              $default = array('sort' => $field, 'order' => $order);
          }
  
          $query += $default;
  
          if (in_array($query['sort'], $allowed)) {
              uasort($list, function ($a, $b) use ($query) {
                  return $this->callbackSortList($a, $b, $query);
              });
          }
      }
code_tokens: protected function sortList ( array & $ list , array $ allowed , array $ query , array $ default = array ( ) ) { if ( empty ( $ default ) ) { $ default = array ( 'sort' => '' , 'order' => '' ) ; } else { $ order = reset ( $ default ) ; $ field = key ( $ default ) ; $ default = array ( 'sort' => $ field , 'order' => $ order ) ; } $ query += $ default ; if ( in_array ( $ query [ 'sort' ] , $ allowed ) ) { uasort ( $ list , function ( $ a , $ b ) use ( $ query ) { return $ this -> callbackSortList ( $ a , $ b , $ query ) ; } ) ; } }
docstring: Sort the list by a field
  @param array $list
  @param array $allowed
  @param array $query
  @param array $default
docstring_tokens: Sort the list by a field