You are here

public function ClamAVConfigForm::scheme_wrappers_available in ClamAV 8

Same name and namespace in other branches
  1. 2.x src/Form/ClamAVConfigForm.php \Drupal\clamav\Form\ClamAVConfigForm::scheme_wrappers_available()

List the available stream-wrappers, according to whether the stream-wrapper is local or remote.

Parameters

string $type: Either 'local' (for local stream-wrappers), or 'remote'.

Return value

array Array of the names of scheme-wrappers, indexed by the machine-name of the scheme-wrapper. For example: array('public' => 'public://').

3 calls to ClamAVConfigForm::scheme_wrappers_available()
ClamAVConfigForm::buildForm in src/Form/ClamAVConfigForm.php
Form constructor.
ClamAVConfigForm::get_overridden_schemes in src/Form/ClamAVConfigForm.php
List which schemes have been overridden.
ClamAVConfigForm::scheme_wrappers_to_scan in src/Form/ClamAVConfigForm.php
List the stream-wrapper schemes that are configured to be scannable, according to whether the scheme is local or remote.

File

src/Form/ClamAVConfigForm.php, line 262

Class

ClamAVConfigForm
Configure file system settings for this site.

Namespace

Drupal\clamav\Form

Code

public function scheme_wrappers_available($type) {
  $mgr = \Drupal::service('stream_wrapper_manager');
  switch ($type) {
    case 'local':
      $schemes = array_keys($mgr
        ->getWrappers(StreamWrapperInterface::LOCAL));
      break;
    case 'remote':
      $schemes = array_keys(array_diff_key($mgr
        ->getWrappers(StreamWrapperInterface::ALL), $mgr
        ->getWrappers(StreamWrapperInterface::LOCAL)));
      break;
  }
  $options = array();
  foreach ($schemes as $scheme) {
    $options[$scheme] = $scheme . '://';
  }
  return $options;
}