Exception   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDriver() 0 3 1
1
<?php
2
3
namespace Drupal\Driver\Exception;
4
5
use Drupal\Driver\DriverInterface;
6
7
/**
8
 * Drupal driver manager base exception class.
9
 */
10
abstract class Exception extends \Exception {
11
12
  /**
13
   * The driver where the exception occurred.
14
   *
15
   * @var \Drupal\Driver\DriverInterface
16
   */
17
  private $driver;
18
19
  /**
20
   * Initializes Drupal driver manager exception.
21
   *
22
   * @param string $message
23
   *   The exception message.
24
   * @param \Drupal\Driver\DriverInterface $driver
25
   *   The driver where the exception occurred.
26
   * @param int $code
27
   *   Optional exception code. Defaults to 0.
28
   * @param \Exception $previous
29
   *   Optional previous exception that was thrown.
30
   */
31
  public function __construct($message, DriverInterface $driver = NULL, $code = 0, \Exception $previous = NULL) {
32
    $this->driver = $driver;
33
34
    parent::__construct($message, $code, $previous);
35
  }
36
37
  /**
38
   * Returns exception driver.
39
   *
40
   * @return \Drupal\Driver\DriverInterface
41
   *   The driver where the exception occurred.
42
   */
43
  public function getDriver() {
44
    return $this->driver;
45
  }
46
47
}
48