You are here

public function Scanner::__construct in ClamAV 8

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

Constructor.

Parameters

object $config: An instance of \Drupal\clamav\Config.

File

src/Scanner.php, line 41

Class

Scanner
Service class for the ClamAV scanner instance.

Namespace

Drupal\clamav

Code

public function __construct(\Drupal\clamav\Config $config) {
  $this->config = $config;
  switch ($config
    ->scan_mode()) {
    case Config::MODE_EXECUTABLE:
      $this->scanner = new Scanner\Executable($this->config);
      break;
    case Config::MODE_DAEMON:
      $this->scanner = new Scanner\DaemonTCPIP($this->config);
      break;
    case Config::MODE_UNIX_SOCKET:
      $this->scanner = new Scanner\DaemonUnixSocket($this->config);
      break;
  }
}