original_string: public function sort(array $ids, array $list)
      {
          $data = array();
          foreach ($ids as $key) {
  
              if (!isset($list[$key])) {
                  return array();
              }
  
              $data[$key] = $list[$key]['sort'];
              foreach (array_keys($list[$key]['requires']) as $dependency) {
                  if (!isset($data[$dependency])) {
                      $data[$dependency] = 0;
                  }
              }
          }
  
          arsort($data);
          return array_keys($data);
      }
code: public function sort(array $ids, array $list)
      {
          $data = array();
          foreach ($ids as $key) {
  
              if (!isset($list[$key])) {
                  return array();
              }
  
              $data[$key] = $list[$key]['sort'];
              foreach (array_keys($list[$key]['requires']) as $dependency) {
                  if (!isset($data[$dependency])) {
                      $data[$dependency] = 0;
                  }
              }
          }
  
          arsort($data);
          return array_keys($data);
      }
code_tokens: public function sort ( array $ ids , array $ list ) { $ data = array ( ) ; foreach ( $ ids as $ key ) { if ( ! isset ( $ list [ $ key ] ) ) { return array ( ) ; } $ data [ $ key ] = $ list [ $ key ] [ 'sort' ] ; foreach ( array_keys ( $ list [ $ key ] [ 'requires' ] ) as $ dependency ) { if ( ! isset ( $ data [ $ dependency ] ) ) { $ data [ $ dependency ] = 0 ; } } } arsort ( $ data ) ; return array_keys ( $ data ) ; }
docstring: Sort a list of IDs according to their dependencies
  Dependent items always go last
  @param array $ids
  @param array $list
  @return array
docstring_tokens: Sort a list of IDs according to their dependencies Dependent items always go last