-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathUpdatePolicy.php
50 lines (43 loc) · 1008 Bytes
/
UpdatePolicy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* ArangoDB PHP client: update policies
*
* @package ArangoDBClient
* @author Jan Steemann
* @copyright Copyright 2012, triagens GmbH, Cologne, Germany
*/
namespace ArangoDBClient;
/**
* Document update policies
*
* @package ArangoDBClient
* @since 0.2
*/
class UpdatePolicy
{
/**
* last update will win in case of conflicting versions
*/
const LAST = 'last';
/**
* an error will be returned in case of conflicting versions
*/
const ERROR = 'error';
/**
* Check if the supplied policy value is valid
*
* @throws ClientException
*
* @param string $value - update policy value
*
* @return void
*/
public static function validate($value)
{
assert(is_string($value));
if ($value !== self::LAST && $value !== self::ERROR) {
throw new ClientException('Invalid update policy');
}
}
}
class_alias(UpdatePolicy::class, '\triagens\ArangoDb\UpdatePolicy');