PhotoQuery.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage Photos
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Gdata_Gapps_Picasa_AlbumQuery
  24. */
  25. require_once('Zend/Gdata/Photos/AlbumQuery.php');
  26. /**
  27. * Assists in constructing queries for comment/tag entries.
  28. * Instances of this class can be provided in many places where a URL is
  29. * required.
  30. *
  31. * For information on submitting queries to a server, see the
  32. * service class, Zend_Gdata_Photos.
  33. *
  34. * @category Zend
  35. * @package Zend_Gdata
  36. * @subpackage Photos
  37. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  38. * @license http://framework.zend.com/license/new-bsd New BSD License
  39. */
  40. class Zend_Gdata_Photos_PhotoQuery extends Zend_Gdata_Photos_AlbumQuery
  41. {
  42. /**
  43. * The ID of the photo to query for.
  44. *
  45. * @var string
  46. */
  47. protected $_photoId = null;
  48. /**
  49. * Set the photo ID to query for. When set, this photo's comments/tags
  50. * will be returned. If not set or null, the default user's feed will be
  51. * returned instead.
  52. *
  53. * @param string $value The ID of the photo to retrieve, or null to
  54. * clear.
  55. */
  56. public function setPhotoId($value)
  57. {
  58. $this->_photoId = $value;
  59. }
  60. /**
  61. * Get the photo ID which is to be returned.
  62. *
  63. * @see setPhoto
  64. * @return string The ID of the photo to retrieve.
  65. */
  66. public function getPhotoId()
  67. {
  68. return $this->_photoId;
  69. }
  70. /**
  71. * Returns the URL generated for this query, based on it's current
  72. * parameters.
  73. *
  74. * @return string A URL generated based on the state of this query.
  75. * @throws Zend_Gdata_App_InvalidArgumentException
  76. */
  77. public function getQueryUrl($incomingUri = '')
  78. {
  79. $uri = '';
  80. if ($this->getPhotoId() !== null) {
  81. $uri .= '/photoid/' . $this->getPhotoId();
  82. } else {
  83. require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  84. throw new Zend_Gdata_App_InvalidArgumentException(
  85. 'PhotoId cannot be null');
  86. }
  87. $uri .= $incomingUri;
  88. return parent::getQueryUrl($uri);
  89. }
  90. }