Completed
Push — master ( 9f3a36...d17503 )
by Jonathan
8s
created

BaseDriver::configGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
/**
4
 * @file
5
 * Contains \Drupal\Driver\BaseDriver.
6
 */
7
8
namespace Drupal\Driver;
9
10
use Drupal\Driver\Exception\UnsupportedDriverActionException;
11
12
/**
13
 * Implements DriverInterface.
14
 */
15
abstract class BaseDriver implements DriverInterface {
16
17
  /**
18
   * {@inheritdoc}
19
   */
20
  public function getRandom() {
21
    throw new UnsupportedDriverActionException($this->errorString('generate random'), $this);
22
  }
23
24
  /**
25
   * {@inheritdoc}
26
   */
27
  public function bootstrap() {
28
  }
29
30
  /**
31
   * {@inheritdoc}
32
   */
33
  public function isBootstrapped() {
34
  }
35
36
  /**
37
   * {@inheritdoc}
38
   */
39
  public function userCreate(\stdClass $user) {
40
    throw new UnsupportedDriverActionException($this->errorString('create users'), $this);
41
  }
42
43
  /**
44
   * {@inheritdoc}
45
   */
46
  public function userDelete(\stdClass $user) {
47
    throw new UnsupportedDriverActionException($this->errorString('delete users'), $this);
48
  }
49
50
  /**
51
   * {@inheritdoc}
52
   */
53
  public function processBatch() {
54
    throw new UnsupportedDriverActionException($this->errorString('process batch actions'), $this);
55
  }
56
57
  /**
58
   * {@inheritdoc}
59
   */
60
  public function userAddRole(\stdClass $user, $role) {
61
    throw new UnsupportedDriverActionException($this->errorString('add roles'), $this);
62
  }
63
64
  /**
65
   * {@inheritdoc}
66
   */
67
  public function fetchWatchdog($count = 10, $type = NULL, $severity = NULL) {
68
    throw new UnsupportedDriverActionException($this->errorString('access watchdog entries'), $this);
69
  }
70
71
  /**
72
   * {@inheritdoc}
73
   */
74
  public function clearCache($type = NULL) {
75
    throw new UnsupportedDriverActionException($this->errorString('clear Drupal caches'), $this);
76
  }
77
78
  /**
79
   * {@inheritdoc}
80
   */
81
  public function clearStaticCaches() {
82
    throw new UnsupportedDriverActionException($this->errorString('clear static caches'), $this);
83
  }
84
85
  /**
86
   * {@inheritdoc}
87
   */
88
  public function createNode($node) {
89
    throw new UnsupportedDriverActionException($this->errorString('create nodes'), $this);
90
  }
91
92
  /**
93
   * {@inheritdoc}
94
   */
95
  public function nodeDelete($node) {
96
    throw new UnsupportedDriverActionException($this->errorString('delete nodes'), $this);
97
  }
98
99
  /**
100
   * {@inheritdoc}
101
   */
102
  public function runCron() {
103
    throw new UnsupportedDriverActionException($this->errorString('run cron'), $this);
104
  }
105
106
  /**
107
   * {@inheritdoc}
108
   */
109
  public function createTerm(\stdClass $term) {
110
    throw new UnsupportedDriverActionException($this->errorString('create terms'), $this);
111
  }
112
113
  /**
114
   * {@inheritdoc}
115
   */
116
  public function termDelete(\stdClass $term) {
117
    throw new UnsupportedDriverActionException($this->errorString('delete terms'), $this);
118
  }
119
120
  /**
121
   * {@inheritdoc}
122
   */
123
  public function roleCreate(array $permissions) {
124
    throw new UnsupportedDriverActionException($this->errorString('create roles'), $this);
125
  }
126
127
  /**
128
   * {@inheritdoc}
129
   */
130
  public function roleDelete($rid) {
131
    throw new UnsupportedDriverActionException($this->errorString('delete roles'), $this);
132
  }
133
134
  /**
135
   * {@inheritdoc}
136
   */
137
  public function isField($entity_type, $field_name) {
138
    return FALSE;
139
  }
140
141
  /**
142
   * {@inheritdoc}
143
   */
144
  public function configGet($name, $key) {
145
    throw new UnsupportedDriverActionException($this->errorString('config get'), $this);
146
  }
147
148
  /**
149
   * {@inheritdoc}
150
   */
151
  public function configSet($name, $key, $value) {
152
    throw new UnsupportedDriverActionException($this->errorString('config set'), $this);
153
  }
154
155
  /**
156
   * Error printing exception.
157
   *
158
   * @param string $error
159
   *   The term, node, user or permission.
160
   *
161
   * @return string
162
   *   A formatted string reminding people to use an API driver.
163
   */
164
  private function errorString($error) {
165
    return sprintf('No ability to %s in %%s. Put `@api` into your feature and add an API driver (ex: `api_driver: drupal`) in behat.yml.', $error);
166
  }
167
168
}
169