You are here

static function Environment::SortCandidateFiles_ in Realistic Dummy Content 8

Given a list of candidate files, sort them by names and parts.

Parameters

$candidate_files: An array keyed by filename which contains drupal file objects. See SortCandidateFiles().

$extensions = NULL: If set, extensions to filter by. See SortCandidateFiles().

Return value

A sorted array. See SortCandidateFiles().

Throws

\Exception

1 call to Environment::SortCandidateFiles_()
Environment::SortCandidateFiles in api/src/environments/Environment.php
Given a list of candidate files, sort them by names and parts.

File

api/src/environments/Environment.php, line 242
Define autoload class.

Class

Environment
The abstract base environment.

Namespace

Drupal\realistic_dummy_content_api\environments

Code

static function SortCandidateFiles_($candidate_files, $extensions = NULL) {
  $return = array();
  foreach ($candidate_files as $candidate_filename => $candidate_file) {
    if (self::validCandidateFilename($candidate_filename, $extensions)) {
      self::addFileToArray($return, $candidate_filename, $candidate_file);
    }
  }

  // We expect the files to be sorted alphabetically, which is not the case on all
  // systems.
  ksort($return);
  return $return;
}