Exception
8 years ago
WebAuthException
8 years ago
certs
8 years ago
AppInfo.php
8 years ago
AppInfoLoadException.php
8 years ago
ArrayEntryStore.php
8 years ago
AuthBase.php
8 years ago
AuthInfo.php
8 years ago
AuthInfoLoadException.php
8 years ago
Checker.php
8 years ago
Client.php
8 years ago
Curl.php
8 years ago
CurlStreamRelay.php
8 years ago
DeserializeException.php
8 years ago
DropboxMetadataHeaderCatcher.php
8 years ago
Exception.php
8 years ago
Host.php
8 years ago
HttpResponse.php
8 years ago
OAuth1AccessToken.php
8 years ago
OAuth1Upgrader.php
8 years ago
Path.php
8 years ago
RequestUtil.php
8 years ago
RootCertificates.php
8 years ago
SSLTester.php
8 years ago
Security.php
8 years ago
StreamReadException.php
8 years ago
Util.php
8 years ago
ValueStore.php
8 years ago
WebAuth.php
5 years ago
WebAuthBase.php
8 years ago
WebAuthNoRedirect.php
8 years ago
WriteMode.php
8 years ago
autoload.php
8 years ago
strict.php
8 years ago
ArrayEntryStore.php
62 lines
| 1 | <?php |
| 2 | namespace Dropbox; |
| 3 | |
| 4 | /** |
| 5 | * A class that gives get/put/clear access to a single entry in an array. |
| 6 | */ |
| 7 | class ArrayEntryStore implements ValueStore |
| 8 | { |
| 9 | /** @var array */ |
| 10 | private $array; |
| 11 | |
| 12 | /** @var mixed */ |
| 13 | private $key; |
| 14 | |
| 15 | /** |
| 16 | * Constructor. |
| 17 | * |
| 18 | * @param array $array |
| 19 | * The array that we'll be accessing. |
| 20 | * |
| 21 | * @param mixed $key |
| 22 | * The key for the array element we'll be accessing. |
| 23 | */ |
| 24 | function __construct(&$array, $key) |
| 25 | { |
| 26 | $this->array = &$array; |
| 27 | $this->key = $key; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Returns the entry's current value or <code>null</code> if nothing is set. |
| 32 | * |
| 33 | * @return object |
| 34 | */ |
| 35 | function get() |
| 36 | { |
| 37 | if (isset($this->array[$this->key])) { |
| 38 | return $this->array[$this->key]; |
| 39 | } else { |
| 40 | return null; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Set the array entry to the given value. |
| 46 | * |
| 47 | * @param object $value |
| 48 | */ |
| 49 | function set($value) |
| 50 | { |
| 51 | $this->array[$this->key] = $value; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Clear the entry. |
| 56 | */ |
| 57 | function clear() |
| 58 | { |
| 59 | unset($this->array[$this->key]); |
| 60 | } |
| 61 | } |
| 62 |