Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Session / SaveHandler / MongoDBOptions.php
blobaad7dfdbb6a43e7b58634c245257826d3db957e2
1 <?php
3 /**
4 * Zend Framework (http://framework.zend.com/)
6 * @link http://github.com/zendframework/zf2 for the canonical source repository
7 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
8 * @license http://framework.zend.com/license/new-bsd New BSD License
9 */
11 namespace Zend\Session\SaveHandler;
13 use Zend\Session\Exception\InvalidArgumentException;
14 use Zend\Stdlib\AbstractOptions;
16 /**
17 * MongoDB session save handler Options
19 class MongoDBOptions extends AbstractOptions
21 /**
22 * Database name
24 * @var string
26 protected $database;
28 /**
29 * Collection name
31 * @var string
33 protected $collection;
35 /**
36 * Save options
38 * @see http://php.net/manual/en/mongocollection.save.php
39 * @var string
41 protected $saveOptions = array('safe' => true);
43 /**
44 * Name field
46 * @var string
48 protected $nameField = 'name';
50 /**
51 * Data field
53 * @var string
55 protected $dataField = 'data';
57 /**
58 * Lifetime field
60 * @var string
62 protected $lifetimeField = 'lifetime';
64 /**
65 * Modified field
67 * @var string
69 protected $modifiedField = 'modified';
71 /**
72 * Set database name
74 * @param string $database
75 * @return MongoDBOptions
76 * @throws InvalidArgumentException
78 public function setDatabase($database)
80 $database = (string) $database;
81 if (strlen($database) === 0) {
82 throw new InvalidArgumentException('$database must be a non-empty string');
84 $this->database = $database;
85 return $this;
88 /**
89 * Get database name
91 * @return string
93 public function getDatabase()
95 return $this->database;
98 /**
99 * Set collection name
101 * @param string $collection
102 * @return MongoDBOptions
103 * @throws InvalidArgumentException
105 public function setCollection($collection)
107 $collection = (string) $collection;
108 if (strlen($collection) === 0) {
109 throw new InvalidArgumentException('$collection must be a non-empty string');
111 $this->collection = $collection;
112 return $this;
116 * Get collection name
118 * @return string
120 public function getCollection()
122 return $this->collection;
126 * Set save options
128 * @see http://php.net/manual/en/mongocollection.save.php
129 * @param array $saveOptions
130 * @return MongoDBOptions
132 public function setSaveOptions(array $saveOptions)
134 $this->saveOptions = $saveOptions;
135 return $this;
139 * Get save options
141 * @return string
143 public function getSaveOptions()
145 return $this->saveOptions;
149 * Set name field
151 * @param string $nameField
152 * @return MongoDBOptions
153 * @throws InvalidArgumentException
155 public function setNameField($nameField)
157 $nameField = (string) $nameField;
158 if (strlen($nameField) === 0) {
159 throw new InvalidArgumentException('$nameField must be a non-empty string');
161 $this->nameField = $nameField;
162 return $this;
166 * Get name field
168 * @return string
170 public function getNameField()
172 return $this->nameField;
176 * Set data field
178 * @param string $dataField
179 * @return MongoDBOptions
180 * @throws InvalidArgumentException
182 public function setDataField($dataField)
184 $dataField = (string) $dataField;
185 if (strlen($dataField) === 0) {
186 throw new InvalidArgumentException('$dataField must be a non-empty string');
188 $this->dataField = $dataField;
189 return $this;
193 * Get data field
195 * @return string
197 public function getDataField()
199 return $this->dataField;
203 * Set lifetime field
205 * @param string $lifetimeField
206 * @return MongoDBOptions
207 * @throws InvalidArgumentException
209 public function setLifetimeField($lifetimeField)
211 $lifetimeField = (string) $lifetimeField;
212 if (strlen($lifetimeField) === 0) {
213 throw new InvalidArgumentException('$lifetimeField must be a non-empty string');
215 $this->lifetimeField = $lifetimeField;
216 return $this;
220 * Get lifetime Field
222 * @return string
224 public function getLifetimeField()
226 return $this->lifetimeField;
230 * Set Modified Field
232 * @param string $modifiedField
233 * @return MongoDBOptions
234 * @throws InvalidArgumentException
236 public function setModifiedField($modifiedField)
238 $modifiedField = (string) $modifiedField;
239 if (strlen($modifiedField) === 0) {
240 throw new InvalidArgumentException('$modifiedField must be a non-empty string');
242 $this->modifiedField = $modifiedField;
243 return $this;
247 * Get modified Field
249 * @return string
251 public function getModifiedField()
253 return $this->modifiedField;