1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * Zend Framework |
---|
5 | * |
---|
6 | * LICENSE |
---|
7 | * |
---|
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. |
---|
15 | * |
---|
16 | * @category Zend |
---|
17 | * @package Zend_Gdata |
---|
18 | * @subpackage Photos |
---|
19 | * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
---|
20 | * @license http://framework.zend.com/license/new-bsd New BSD License |
---|
21 | * @version $Id: PhotoQuery.php 24594 2012-01-05 21:27:01Z matthew $ |
---|
22 | */ |
---|
23 | |
---|
24 | /** |
---|
25 | * @see Zend_Gdata_Gapps_Picasa_AlbumQuery |
---|
26 | */ |
---|
27 | require_once('Zend/Gdata/Photos/AlbumQuery.php'); |
---|
28 | |
---|
29 | /** |
---|
30 | * Assists in constructing queries for comment/tag entries. |
---|
31 | * Instances of this class can be provided in many places where a URL is |
---|
32 | * required. |
---|
33 | * |
---|
34 | * For information on submitting queries to a server, see the |
---|
35 | * service class, Zend_Gdata_Photos. |
---|
36 | * |
---|
37 | * @category Zend |
---|
38 | * @package Zend_Gdata |
---|
39 | * @subpackage Photos |
---|
40 | * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
---|
41 | * @license http://framework.zend.com/license/new-bsd New BSD License |
---|
42 | */ |
---|
43 | class Zend_Gdata_Photos_PhotoQuery extends Zend_Gdata_Photos_AlbumQuery |
---|
44 | { |
---|
45 | |
---|
46 | /** |
---|
47 | * The ID of the photo to query for. |
---|
48 | * |
---|
49 | * @var string |
---|
50 | */ |
---|
51 | protected $_photoId = null; |
---|
52 | |
---|
53 | /** |
---|
54 | * Set the photo ID to query for. When set, this photo's comments/tags |
---|
55 | * will be returned. If not set or null, the default user's feed will be |
---|
56 | * returned instead. |
---|
57 | * |
---|
58 | * @param string $value The ID of the photo to retrieve, or null to |
---|
59 | * clear. |
---|
60 | */ |
---|
61 | public function setPhotoId($value) |
---|
62 | { |
---|
63 | $this->_photoId = $value; |
---|
64 | } |
---|
65 | |
---|
66 | /** |
---|
67 | * Get the photo ID which is to be returned. |
---|
68 | * |
---|
69 | * @see setPhoto |
---|
70 | * @return string The ID of the photo to retrieve. |
---|
71 | */ |
---|
72 | public function getPhotoId() |
---|
73 | { |
---|
74 | return $this->_photoId; |
---|
75 | } |
---|
76 | |
---|
77 | /** |
---|
78 | * Returns the URL generated for this query, based on it's current |
---|
79 | * parameters. |
---|
80 | * |
---|
81 | * @return string A URL generated based on the state of this query. |
---|
82 | * @throws Zend_Gdata_App_InvalidArgumentException |
---|
83 | */ |
---|
84 | public function getQueryUrl($incomingUri = '') |
---|
85 | { |
---|
86 | $uri = ''; |
---|
87 | if ($this->getPhotoId() !== null) { |
---|
88 | $uri .= '/photoid/' . $this->getPhotoId(); |
---|
89 | } else { |
---|
90 | require_once 'Zend/Gdata/App/InvalidArgumentException.php'; |
---|
91 | throw new Zend_Gdata_App_InvalidArgumentException( |
---|
92 | 'PhotoId cannot be null'); |
---|
93 | } |
---|
94 | $uri .= $incomingUri; |
---|
95 | return parent::getQueryUrl($uri); |
---|
96 | } |
---|
97 | |
---|
98 | } |
---|