File indexing completed on 2025-01-26 05:29:35
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_Gdata 0018 * @subpackage Photos 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 /** 0025 * @see Zend_Gdata_Photos_UserQuery 0026 */ 0027 // require_once('Zend/Gdata/Photos/UserQuery.php'); 0028 0029 /** 0030 * Assists in constructing album queries for various entries. 0031 * Instances of this class can be provided in many places where a URL is 0032 * required. 0033 * 0034 * For information on submitting queries to a server, see the service 0035 * class, Zend_Gdata_Photos. 0036 * 0037 * @category Zend 0038 * @package Zend_Gdata 0039 * @subpackage Photos 0040 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0041 * @license http://framework.zend.com/license/new-bsd New BSD License 0042 */ 0043 class Zend_Gdata_Photos_AlbumQuery extends Zend_Gdata_Photos_UserQuery 0044 { 0045 0046 /** 0047 * The name of the album to query for. Mutually exclusive with AlbumId. 0048 * 0049 * @var string 0050 */ 0051 protected $_albumName = null; 0052 0053 /** 0054 * The ID of the album to query for. Mutually exclusive with AlbumName. 0055 * 0056 * @var string 0057 */ 0058 protected $_albumId = null; 0059 0060 /** 0061 * Set the album name to query for. When set, this album's photographs 0062 * be returned. If not set or null, the default user's feed will be 0063 * returned instead. 0064 * 0065 * NOTE: AlbumName and AlbumId are mutually exclusive. Setting one will 0066 * automatically set the other to null. 0067 * 0068 * @param string $value The name of the album to retrieve, or null to 0069 * clear. 0070 * @return Zend_Gdata_Photos_AlbumQuery The query object. 0071 */ 0072 public function setAlbumName($value) 0073 { 0074 $this->_albumId = null; 0075 $this->_albumName = $value; 0076 0077 return $this; 0078 } 0079 0080 /** 0081 * Get the album name which is to be returned. 0082 * 0083 * @see setAlbumName 0084 * @return string The name of the album to retrieve. 0085 */ 0086 public function getAlbumName() 0087 { 0088 return $this->_albumName; 0089 } 0090 0091 /** 0092 * Set the album ID to query for. When set, this album's photographs 0093 * be returned. If not set or null, the default user's feed will be 0094 * returned instead. 0095 * 0096 * NOTE: Album and AlbumId are mutually exclusive. Setting one will 0097 * automatically set the other to null. 0098 * 0099 * @param string $value The ID of the album to retrieve, or null to 0100 * clear. 0101 * @return Zend_Gdata_Photos_AlbumQuery The query object. 0102 */ 0103 public function setAlbumId($value) 0104 { 0105 $this->_albumName = null; 0106 $this->_albumId = $value; 0107 0108 return $this; 0109 } 0110 0111 /** 0112 * Get the album ID which is to be returned. 0113 * 0114 * @see setAlbum 0115 * @return string The ID of the album to retrieve. 0116 */ 0117 public function getAlbumId() 0118 { 0119 return $this->_albumId; 0120 } 0121 0122 /** 0123 * Returns the URL generated for this query, based on it's current 0124 * parameters. 0125 * 0126 * @return string A URL generated based on the state of this query. 0127 * @throws Zend_Gdata_App_InvalidArgumentException 0128 */ 0129 public function getQueryUrl($incomingUri = '') 0130 { 0131 $uri = ''; 0132 if ($this->getAlbumName() !== null && $this->getAlbumId() === null) { 0133 $uri .= '/album/' . $this->getAlbumName(); 0134 } elseif ($this->getAlbumName() === null && $this->getAlbumId() !== null) { 0135 $uri .= '/albumid/' . $this->getAlbumId(); 0136 } elseif ($this->getAlbumName() !== null && $this->getAlbumId() !== null) { 0137 // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 0138 throw new Zend_Gdata_App_InvalidArgumentException( 0139 'AlbumName and AlbumId cannot both be non-null'); 0140 } else { 0141 // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 0142 throw new Zend_Gdata_App_InvalidArgumentException( 0143 'AlbumName and AlbumId cannot both be null'); 0144 } 0145 $uri .= $incomingUri; 0146 return parent::getQueryUrl($uri); 0147 } 0148 0149 }