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