Completed
Push — master ( ef3bca...8ad209 )
by Jonathan
02:53 queued 01:19
created

BaseDriver::getMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Drupal\Driver;
4
5
use Drupal\Driver\Exception\UnsupportedDriverActionException;
6
7
/**
8
 * Implements DriverInterface.
9
 */
10
abstract class BaseDriver implements DriverInterface {
11
12
  /**
13
   * {@inheritdoc}
14
   */
15
  public function getRandom() {
16
    throw new UnsupportedDriverActionException($this->errorString('generate random'), $this);
17
  }
18
19
  /**
20
   * {@inheritdoc}
21
   */
22
  public function bootstrap() {
23
  }
24
25
  /**
26
   * {@inheritdoc}
27
   */
28
  public function isBootstrapped() {
29
  }
30
31
  /**
32
   * {@inheritdoc}
33
   */
34
  public function userCreate(\stdClass $user) {
35
    throw new UnsupportedDriverActionException($this->errorString('create users'), $this);
36
  }
37
38
  /**
39
   * {@inheritdoc}
40
   */
41
  public function userDelete(\stdClass $user) {
42
    throw new UnsupportedDriverActionException($this->errorString('delete users'), $this);
43
  }
44
45
  /**
46
   * {@inheritdoc}
47
   */
48
  public function processBatch() {
49
    throw new UnsupportedDriverActionException($this->errorString('process batch actions'), $this);
50
  }
51
52
  /**
53
   * {@inheritdoc}
54
   */
55
  public function userAddRole(\stdClass $user, $role) {
56
    throw new UnsupportedDriverActionException($this->errorString('add roles'), $this);
57
  }
58
59
  /**
60
   * {@inheritdoc}
61
   */
62
  public function fetchWatchdog($count = 10, $type = NULL, $severity = NULL) {
63
    throw new UnsupportedDriverActionException($this->errorString('access watchdog entries'), $this);
64
  }
65
66
  /**
67
   * {@inheritdoc}
68
   */
69
  public function clearCache($type = NULL) {
70
    throw new UnsupportedDriverActionException($this->errorString('clear Drupal caches'), $this);
71
  }
72
73
  /**
74
   * {@inheritdoc}
75
   */
76
  public function clearStaticCaches() {
77
    throw new UnsupportedDriverActionException($this->errorString('clear static caches'), $this);
78
  }
79
80
  /**
81
   * {@inheritdoc}
82
   */
83
  public function createNode($node) {
84
    throw new UnsupportedDriverActionException($this->errorString('create nodes'), $this);
85
  }
86
87
  /**
88
   * {@inheritdoc}
89
   */
90
  public function nodeDelete($node) {
91
    throw new UnsupportedDriverActionException($this->errorString('delete nodes'), $this);
92
  }
93
94
  /**
95
   * {@inheritdoc}
96
   */
97
  public function runCron() {
98
    throw new UnsupportedDriverActionException($this->errorString('run cron'), $this);
99
  }
100
101
  /**
102
   * {@inheritdoc}
103
   */
104
  public function createTerm(\stdClass $term) {
105
    throw new UnsupportedDriverActionException($this->errorString('create terms'), $this);
106
  }
107
108
  /**
109
   * {@inheritdoc}
110
   */
111
  public function termDelete(\stdClass $term) {
112
    throw new UnsupportedDriverActionException($this->errorString('delete terms'), $this);
113
  }
114
115
  /**
116
   * {@inheritdoc}
117
   */
118
  public function roleCreate(array $permissions) {
119
    throw new UnsupportedDriverActionException($this->errorString('create roles'), $this);
120
  }
121
122
  /**
123
   * {@inheritdoc}
124
   */
125
  public function roleDelete($rid) {
126
    throw new UnsupportedDriverActionException($this->errorString('delete roles'), $this);
127
  }
128
129
  /**
130
   * {@inheritdoc}
131
   */
132
  public function isField($entity_type, $field_name) {
133
    return FALSE;
134
  }
135
136
  /**
137
   * {@inheritdoc}
138
   */
139
  public function configGet($name, $key) {
140
    throw new UnsupportedDriverActionException($this->errorString('config get'), $this);
141
  }
142
143
  /**
144
   * {@inheritdoc}
145
   */
146
  public function configSet($name, $key, $value) {
147
    throw new UnsupportedDriverActionException($this->errorString('config set'), $this);
148
  }
149
150
  /**
151
   * Error printing exception.
152
   *
153
   * @param string $error
154
   *   The term, node, user or permission.
155
   *
156
   * @return string
157
   *   A formatted string reminding people to use an API driver.
158
   */
159
  private function errorString($error) {
160
    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);
161
  }
162
163
  /**
164
   * {@inheritdoc}
165
   */
166
  public function createEntity($entity_type, \stdClass $entity) {
167
    throw new UnsupportedDriverActionException($this->errorString('create entities using the generic Entity API'), $this);
168
  }
169
170
  /**
171
   * {@inheritdoc}
172
   */
173
  public function entityDelete($entity_type, \stdClass $entity) {
174
    throw new UnsupportedDriverActionException($this->errorString('delete entities using the generic Entity API'), $this);
175
  }
176
177
  /**
178
   * {@inheritdoc}
179
   */
180
  public function startCollectingMail() {
181
    throw new UnsupportedDriverActionException($this->errorString('work with mail'), $this);
182
  }
183
184
  /**
185
   * {@inheritdoc}
186
   */
187
  public function stopCollectingMail() {
188
    throw new UnsupportedDriverActionException($this->errorString('work with mail'), $this);
189
  }
190
191
  /**
192
   * {@inheritdoc}
193
   */
194
  public function getMail() {
195
    throw new UnsupportedDriverActionException($this->errorString('work with mail'), $this);
196
  }
197
198
  /**
199
   * {@inheritdoc}
200
   */
201
  public function clearMail() {
202
    throw new UnsupportedDriverActionException($this->errorString('work with mail'), $this);
203
  }
204
205
  /**
206
   * {@inheritdoc}
207
   */
208
  public function sendMail($body, $subject, $to, $langcode) {
209
    throw new UnsupportedDriverActionException($this->errorString('work with mail'), $this);
210
  }
211
212
}
213