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.
19 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: NicknameQuery.php 16971 2009-07-22 18:05:45Z mikaelkael $
25 * @see Zend_Gdata_Gapps_Query
27 require_once('Zend/Gdata/Gapps/Query.php');
30 * Assists in constructing queries for Google Apps nickname entries.
31 * Instances of this class can be provided in many places where a URL is
34 * For information on submitting queries to a server, see the Google Apps
35 * service class, Zend_Gdata_Gapps.
40 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Gapps_NicknameQuery
extends Zend_Gdata_Gapps_Query
47 * If not null, indicates the name of the nickname entry which
48 * should be returned by this query.
52 protected $_nickname = null;
55 * Create a new instance.
57 * @param string $domain (optional) The Google Apps-hosted domain to use
58 * when constructing query URIs.
59 * @param string $nickname (optional) Value for the nickname
61 * @param string $username (optional) Value for the username
63 * @param string $startNickname (optional) Value for the
64 * startNickname property.
66 public function __construct($domain = null, $nickname = null,
67 $username = null, $startNickname = null)
69 parent
::__construct($domain);
70 $this->setNickname($nickname);
71 $this->setUsername($username);
72 $this->setStartNickname($startNickname);
76 * Set the nickname to query for. When set, only users with a nickname
77 * matching this value will be returned in search results. Set to
78 * null to disable filtering by username.
80 * @param string $value The nickname to filter search results by, or null
83 public function setNickname($value)
85 $this->_nickname
= $value;
89 * Get the nickname to query for. If no nickname is set, null will be
93 * @return string The nickname to filter search results by, or null if
96 public function getNickname()
98 return $this->_nickname
;
102 * Set the username to query for. When set, only users with a username
103 * matching this value will be returned in search results. Set to
104 * null to disable filtering by username.
106 * @param string $value The username to filter search results by, or null
109 public function setUsername($value)
111 if ($value !== null) {
112 $this->_params
['username'] = $value;
115 unset($this->_params
['username']);
120 * Get the username to query for. If no username is set, null will be
124 * @return string The username to filter search results by, or null if
127 public function getUsername()
129 if (array_key_exists('username', $this->_params
)) {
130 return $this->_params
['username'];
137 * Set the first nickname which should be displayed when retrieving
138 * a list of nicknames.
140 * @param string $value The first nickname to be returned, or null to
143 public function setStartNickname($value)
145 if ($value !== null) {
146 $this->_params
['startNickname'] = $value;
148 unset($this->_params
['startNickname']);
153 * Get the first nickname which should be displayed when retrieving
154 * a list of nicknames.
156 * @return string The first nickname to be returned, or null to
159 public function getStartNickname()
161 if (array_key_exists('startNickname', $this->_params
)) {
162 return $this->_params
['startNickname'];
169 * Returns the URL generated for this query, based on it's current
172 * @return string A URL generated based on the state of this query.
174 public function getQueryUrl()
177 $uri = $this->getBaseUrl();
178 $uri .= Zend_Gdata_Gapps
::APPS_NICKNAME_PATH
;
179 if ($this->_nickname
!== null) {
180 $uri .= '/' . $this->_nickname
;
182 $uri .= $this->getQueryString();