sortGuessers example

if ($wrapper = $this->streamWrapperManager->getViaUri($path)) {
      // Get the real path from the stream wrapper, if available. Files stored       // in remote file systems will not have one.       $real_path = $wrapper->realpath();
      if ($real_path !== FALSE) {
        $path = $real_path;
      }
    }

    if ($this->sortedGuessers === NULL) {
      // Sort is not triggered yet.       $this->sortedGuessers = $this->sortGuessers();
    }

    foreach ($this->sortedGuessers as $guesser) {
      $mime_type = $guesser->guessMimeType($path);
      if ($mime_type !== NULL) {
        return $mime_type;
      }
    }

    return NULL;
  }

  
Home | Imprint | This part of the site doesn't use cookies.