[ZF-10089] Zend_Log
[zend/radio.git] / library / Zend / Gdata / Photos / UserQuery.php
blobddf80630bb074b880c4a6f4658713b00015e2720
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Photos
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id$
24 /**
25 * @see Zend_Gdata_Gapps_Query
27 require_once('Zend/Gdata/Gapps/Query.php');
29 /**
30 * Assists in constructing queries for user entries.
31 * Instances of this class can be provided in many places where a URL is
32 * required.
34 * For information on submitting queries to a server, see the
35 * service class, Zend_Gdata_Photos.
37 * @category Zend
38 * @package Zend_Gdata
39 * @subpackage Photos
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Photos_UserQuery extends Zend_Gdata_Query
46 /**
47 * Indicates the format of data returned in Atom feeds. Can be either
48 * 'api' or 'base'. Default value is 'api'.
50 * @var string
52 protected $_projection = 'api';
54 /**
55 * Indicates whether to request a feed or entry in queries. Default
56 * value is 'feed';
58 * @var string
60 protected $_type = 'feed';
62 /**
63 * A string which, if not null, indicates which user should
64 * be retrieved by this query. If null, the default user will be used
65 * instead.
67 * @var string
69 protected $_user = Zend_Gdata_Photos::DEFAULT_USER;
71 /**
72 * Create a new Query object with default values.
74 public function __construct()
76 parent::__construct();
79 /**
80 * Set's the format of data returned in Atom feeds. Can be either
81 * 'api' or 'base'. Normally, 'api' will be desired. Default is 'api'.
83 * @param string $value
84 * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface
86 public function setProjection($value)
88 $this->_projection = $value;
89 return $this;
92 /**
93 * Gets the format of data in returned in Atom feeds.
95 * @see setProjection
96 * @return string projection
98 public function getProjection()
100 return $this->_projection;
104 * Set's the type of data returned in queries. Can be either
105 * 'feed' or 'entry'. Normally, 'feed' will be desired. Default is 'feed'.
107 * @param string $value
108 * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface
110 public function setType($value)
112 $this->_type = $value;
113 return $this;
117 * Gets the type of data in returned in queries.
119 * @see setType
120 * @return string type
122 public function getType()
124 return $this->_type;
128 * Set the user to query for. When set, this user's feed will be
129 * returned. If not set or null, the default user's feed will be returned
130 * instead.
132 * @param string $value The user to retrieve, or null for the default
133 * user.
135 public function setUser($value)
137 if ($value !== null) {
138 $this->_user = $value;
139 } else {
140 $this->_user = Zend_Gdata_Photos::DEFAULT_USER;
145 * Get the user which is to be returned.
147 * @see setUser
148 * @return string The visibility to retrieve.
150 public function getUser()
152 return $this->_user;
156 * Set the visibility filter for entries returned. Only entries which
157 * match this value will be returned. If null or unset, the default
158 * value will be used instead.
160 * Valid values are 'all' (default), 'public', and 'private'.
162 * @param string $value The visibility to filter by, or null to use the
163 * default value.
165 public function setAccess($value)
167 if ($value !== null) {
168 $this->_params['access'] = $value;
169 } else {
170 unset($this->_params['access']);
175 * Get the visibility filter for entries returned.
177 * @see setAccess
178 * @return string The visibility to filter by, or null for the default
179 * user.
181 public function getAccess()
183 return $this->_params['access'];
187 * Set the tag for entries that are returned. Only entries which
188 * match this value will be returned. If null or unset, this filter will
189 * not be applied.
191 * See http://code.google.com/apis/picasaweb/reference.html#Parameters
192 * for a list of valid values.
194 * @param string $value The tag to filter by, or null if no
195 * filter is to be applied.
197 public function setTag($value)
199 if ($value !== null) {
200 $this->_params['tag'] = $value;
201 } else {
202 unset($this->_params['tag']);
207 * Get the tag filter for entries returned.
209 * @see setTag
210 * @return string The tag to filter by, or null if no filter
211 * is to be applied.
213 public function getTag()
215 return $this->_params['tag'];
219 * Set the kind of entries that are returned. Only entries which
220 * match this value will be returned. If null or unset, this filter will
221 * not be applied.
223 * See http://code.google.com/apis/picasaweb/reference.html#Parameters
224 * for a list of valid values.
226 * @param string $value The kind to filter by, or null if no
227 * filter is to be applied.
229 public function setKind($value)
231 if ($value !== null) {
232 $this->_params['kind'] = $value;
233 } else {
234 unset($this->_params['kind']);
239 * Get the kind of entries to be returned.
241 * @see setKind
242 * @return string The kind to filter by, or null if no filter
243 * is to be applied.
245 public function getKind()
247 return $this->_params['kind'];
251 * Set the maximum image size for entries returned. Only entries which
252 * match this value will be returned. If null or unset, this filter will
253 * not be applied.
255 * See http://code.google.com/apis/picasaweb/reference.html#Parameters
256 * for a list of valid values.
258 * @param string $value The image size to filter by, or null if no
259 * filter is to be applied.
261 public function setImgMax($value)
263 if ($value !== null) {
264 $this->_params['imgmax'] = $value;
265 } else {
266 unset($this->_params['imgmax']);
271 * Get the maximum image size filter for entries returned.
273 * @see setImgMax
274 * @return string The image size size to filter by, or null if no filter
275 * is to be applied.
277 public function getImgMax()
279 return $this->_params['imgmax'];
283 * Set the thumbnail size filter for entries returned. Only entries which
284 * match this value will be returned. If null or unset, this filter will
285 * not be applied.
287 * See http://code.google.com/apis/picasaweb/reference.html#Parameters
288 * for a list of valid values.
290 * @param string $value The thumbnail size to filter by, or null if no
291 * filter is to be applied.
293 public function setThumbsize($value)
295 if ($value !== null) {
296 $this->_params['thumbsize'] = $value;
297 } else {
298 unset($this->_params['thumbsize']);
303 * Get the thumbnail size filter for entries returned.
305 * @see setThumbsize
306 * @return string The thumbnail size to filter by, or null if no filter
307 * is to be applied.
309 public function getThumbsize()
311 return $this->_params['thumbsize'];
315 * Returns the URL generated for this query, based on it's current
316 * parameters.
318 * @return string A URL generated based on the state of this query.
319 * @throws Zend_Gdata_App_InvalidArgumentException
321 public function getQueryUrl($incomingUri = null)
323 $uri = Zend_Gdata_Photos::PICASA_BASE_URI;
325 if ($this->getType() !== null) {
326 $uri .= '/' . $this->getType();
327 } else {
328 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
329 throw new Zend_Gdata_App_InvalidArgumentException(
330 'Type must be feed or entry, not null');
333 if ($this->getProjection() !== null) {
334 $uri .= '/' . $this->getProjection();
335 } else {
336 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
337 throw new Zend_Gdata_App_InvalidArgumentException(
338 'Projection must not be null');
341 if ($this->getUser() !== null) {
342 $uri .= '/user/' . $this->getUser();
343 } else {
344 // Should never occur due to setter behavior
345 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
346 throw new Zend_Gdata_App_InvalidArgumentException(
347 'User must not be null');
350 $uri .= $incomingUri;
351 $uri .= $this->getQueryString();
352 return $uri;