1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of SwiftMailer. |
5
|
|
|
* (c) 2004-2009 Chris Corbyn |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Provides a mechanism for storing data using two keys. |
13
|
|
|
* |
14
|
|
|
* @author Chris Corbyn |
15
|
|
|
*/ |
16
|
|
|
interface Swift_KeyCache |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
/** Mode for replacing existing cached data */ |
19
|
|
|
const MODE_WRITE = 1; |
20
|
|
|
|
21
|
|
|
/** Mode for appending data to the end of existing cached data */ |
22
|
|
|
const MODE_APPEND = 2; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Set a string into the cache under $itemKey for the namespace $nsKey. |
26
|
|
|
* |
27
|
|
|
* @see MODE_WRITE, MODE_APPEND |
28
|
|
|
* |
29
|
|
|
* @param string $nsKey |
30
|
|
|
* @param string $itemKey |
31
|
|
|
* @param string $string |
32
|
|
|
* @param int $mode |
33
|
|
|
*/ |
34
|
|
|
public function setString($nsKey, $itemKey, $string, $mode); |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Set a ByteStream into the cache under $itemKey for the namespace $nsKey. |
38
|
|
|
* |
39
|
|
|
* @see MODE_WRITE, MODE_APPEND |
40
|
|
|
* |
41
|
|
|
* @param string $nsKey |
42
|
|
|
* @param string $itemKey |
43
|
|
|
* @param Swift_OutputByteStream $os |
44
|
|
|
* @param int $mode |
45
|
|
|
*/ |
46
|
|
|
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode); |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Provides a ByteStream which when written to, writes data to $itemKey. |
50
|
|
|
* |
51
|
|
|
* NOTE: The stream will always write in append mode. |
52
|
|
|
* If the optional third parameter is passed all writes will go through $is. |
53
|
|
|
* |
54
|
|
|
* @param string $nsKey |
55
|
|
|
* @param string $itemKey |
56
|
|
|
* @param Swift_InputByteStream $is optional input stream |
57
|
|
|
* |
58
|
|
|
* @return Swift_InputByteStream |
59
|
|
|
*/ |
60
|
|
|
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $is = null); |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get data back out of the cache as a string. |
64
|
|
|
* |
65
|
|
|
* @param string $nsKey |
66
|
|
|
* @param string $itemKey |
67
|
|
|
* |
68
|
|
|
* @return string |
69
|
|
|
*/ |
70
|
|
|
public function getString($nsKey, $itemKey); |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Get data back out of the cache as a ByteStream. |
74
|
|
|
* |
75
|
|
|
* @param string $nsKey |
76
|
|
|
* @param string $itemKey |
77
|
|
|
* @param Swift_InputByteStream $is stream to write the data to |
78
|
|
|
*/ |
79
|
|
|
public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is); |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Check if the given $itemKey exists in the namespace $nsKey. |
83
|
|
|
* |
84
|
|
|
* @param string $nsKey |
85
|
|
|
* @param string $itemKey |
86
|
|
|
* |
87
|
|
|
* @return bool |
88
|
|
|
*/ |
89
|
|
|
public function hasKey($nsKey, $itemKey); |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Clear data for $itemKey in the namespace $nsKey if it exists. |
93
|
|
|
* |
94
|
|
|
* @param string $nsKey |
95
|
|
|
* @param string $itemKey |
96
|
|
|
*/ |
97
|
|
|
public function clearKey($nsKey, $itemKey); |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Clear all data in the namespace $nsKey if it exists. |
101
|
|
|
* |
102
|
|
|
* @param string $nsKey |
103
|
|
|
*/ |
104
|
|
|
public function clearAll($nsKey); |
105
|
|
|
} |
106
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.