|
|
Created:
15 years, 1 month ago by api.jhartmann-google Modified:
14 years, 8 months ago Reviewers:
Trevor Johns (Google) Base URL:
http://framework.zend.com/svn/framework/standard/trunk Visibility:
Public. |
DescriptionAs per http://framework.zend.com/issues/browse/ZF-5275
Patch Set 1 #Patch Set 2 : Updated #Patch Set 3 : Updated #MessagesTotal messages: 3
Adding some additional attributes: http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_y... (also present in v1 apparently...)
Sign in to reply to this message.
I'm still getting errors, so I'm doing this review manually. Search for lines that stat with ! to see my comments. Index: Statistics.php =================================================================== --- Statistics.php (revision 14089) +++ Statistics.php (working copy) @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Gdata * @subpackage YouTube - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Gdata * @subpackage YouTube - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension @@ -39,20 +39,72 @@ protected $_rootNamespace = 'yt'; protected $_rootElement = 'statistics'; + + /** + * When the viewCount attribute refers to a video entry, the attribute + * specifies the number of times that the video has been viewed. + * When the viewCount attribute refers to a user profile, the attribute + * specifies the number of times that the user's profile has been + * viewed. + * + * @var integer + */ protected $_viewCount = null; - protected $_watchCount = null; /** + * The videoWatchCount attribute specifies the number of videos + * that a user has watched on YouTube. The videoWatchCount attribute + * is only specified when the <yt:statistics> tag appears within a + * user profile entry. + * + * @var integer ! Just to check, this is actually an integer and not an object, right? It ! looks like this should be an object. (Also applies for other doc comments ! below.) + */ + protected $_videoWatchCount = null; + + /** + * The subscriberCount attribute specifies the number of YouTube users + * who have subscribed to a particular user's YouTube channel. + * The subscriberCount attribute is only specified when the + * <yt:statistics> tag appears within a user profile entry. + * + * @var integer + */ + protected $_subscriberCount = null; + + /** + * The lastWebAccess attribute indicates the most recent time that + * a particular user used YouTube. + * + * @var string + */ + protected $_lastWebAccess = null; + + /** + * The favoriteCount attribute specifies the number of YouTube users + * who have added a video to their list of favorite videos. The + * favoriteCount attribute is only specified when the + * <yt:statistics> tag appears within a video entry. + * + * @var integer + */ + protected $_favoriteCount = null; + + /** * Constructs a new Zend_Gdata_YouTube_Extension_Statistics object. * @param string $viewCount(optional) The viewCount value * @param string $watchCount(optional) The watchCount value ! Add extra @params here. */ - public function __construct($viewCount = null, $watchCount = null) + public function __construct($viewCount = null, $videoWatchCount = null, + $subscriberCount = null, $lastWebAccess = null, + $favoriteCount = null) { $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); parent::__construct(); $this->_viewCount = $viewCount; - $this->_watchCount = $watchCount; + $this->_videoWatchCount = $watchCount; + $this->_subscriberCount = $subscriberCount; + $this->_lastWebAccess = $lastWebAccess; + $this->_favoriteCount = $favoriteCount; } /** @@ -71,9 +123,21 @@ if ($this->_viewCount !== null) { $element->setAttribute('viewCount', $this->_viewCount); } - if ($this->_watchCount !== null) { - $element->setAttribute('watchCount', $this->_watchCount); + if ($this->_videoWatchCount !== null) { + $element->setAttribute('watchCount', $this->_videoWatchCount); } + if ($this->_subscriberCount !== null) { + $element->setAttribute('subscriberCount', + $this->_subscriberCount); + } + if ($this->_lastWebAccess !== null) { + $element->setAttribute('lastWebAccess', + $this->_lastWebAccess); + } + if ($this->_favoriteCount !== null) { + $element->setAttribute('favoriteCount', + $this->_favoriteCount); + } return $element; } @@ -91,9 +155,18 @@ case 'viewCount': $this->_viewCount = $attribute->nodeValue; break; - case 'watchCount': - $this->_watchCount = $attribute->nodeValue; + case 'videoWatchCount': + $this->_videoWatchCount = $attribute->nodeValue; break; + case 'subscriberCount': + $this->_subscriberCount = $attribute->nodeValue; + break; + case 'lastWebAccess': + $this->_lastWebAccess = $attribute->nodeValue; + break; + case 'favoriteCount': + $this->_favoriteCount = $attribute->nodeValue; + break; default: parent::takeAttributeFromDOM($attribute); } @@ -113,7 +186,8 @@ * Set the value for this element's viewCount attribute. * * @param int $value The desired value for this attribute. - * @return Zend_Gdata_YouTube_Extension_Statistics The element being modified. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. */ public function setViewCount($value) { @@ -122,28 +196,98 @@ } /** - * Get the value for this element's watchCount attribute. + * Get the value for this element's videoWatchCount attribute. * * @return int The value associated with this attribute. */ - public function getWatchCount() + public function getVideoWatchCount() { - return $this->_watchCount; + return $this->_videoWatchCount; } /** - * Set the value for this element's watchCount attribute. + * Set the value for this element's videoWatchCount attribute. * * @param int $value The desired value for this attribute. - * @return Zend_Gdata_YouTube_Extension_Statistics The element being modified. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. */ - public function setWatchCount($value) + public function setVideoWatchCount($value) { - $this->_watchCount = $value; + $this->_videoWatchCount = $value; return $this; } /** + * Get the value for this element's subscriberCount attribute. + * + * @return int The value associated with this attribute. + */ + public function getSubscriberCount() + { + return $this->_subscriberCount; + } + + /** + * Set the value for this element's subscriberCount attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setSubscriberCount($value) + { + $this->_subscriberCount = $value; + return $this; + } + + /** + * Get the value for this element's lastWebAccess attribute. + * + * @return int The value associated with this attribute. + */ + public function getLastWebAccess() + { + return $this->_lastWebAccess; + } + + /** + * Set the value for this element's lastWebAccess attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setLastWebAccess($value) + { + $this->_lastWebAccess = $value; + return $this; + } + + /** + * Get the value for this element's favoriteCount attribute. + * + * @return int The value associated with this attribute. + */ + public function getFavoriteCount() + { + return $this->_favoriteCount; + } + + /** + * Set the value for this element's favoriteCount attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setFavoriteCount($value) + { + $this->_favoriteCount = $value; + return $this; + } + + /** * Magic toString method allows using this directly via echo * Works best in PHP >= 4.2.0 * @@ -151,7 +295,11 @@ */ public function __toString() { - return 'View Count=' . $this->_viewCount; + return 'View Count=' . $this->_viewCount . + ' VideoWatchCount=' . $this->_videoWatchCount . + ' SubscriberCount=' . $this->_subscriberCount . + ' LastWebAccess=' . $this->_lastWebAccess . + ' FavoriteCount=' . $this->_favoriteCount; } }
Sign in to reply to this message.
Updated (had to cut out your comments since I was running into message size limits): On 2009/02/27 03:03:56, Trevor Johns (Google) wrote: > I'm still getting errors, so I'm doing this review manually. SVN seems to be down. I am going to respond to your comments here: > > Index: Statistics.php > =================================================================== > --- Statistics.php (revision 14089) > +++ Statistics.php (working copy) > @@ -16,7 +16,7 @@ > * @category Zend > * @package Zend_Gdata > + * @var integer > + */ > protected $_viewCount = null; > - protected $_watchCount = null; > > /** > + * The videoWatchCount attribute specifies the number of videos > + * that a user has watched on YouTube. The videoWatchCount attribute > + * is only specified when the <yt:statistics> tag appears within a > + * user profile entry. > + * > + * @var integer > > ! Just to check, this is actually an integer and not an object, right? It > ! looks like this should be an object. (Also applies for other doc comments > ! below.) I looked into this a bit and it seems like we are OK with just using integers. That's how the old 'viewCount' attribute worked as well. Note these are just XML attributes so I don't think they need to become objects. > > + */ > + protected $_videoWatchCount = null; > + > + /** > * Constructs a new Zend_Gdata_YouTube_Extension_Statistics object. > * @param string $viewCount(optional) The viewCount value > * @param string $watchCount(optional) The watchCount value > > ! Add extra @params here. Done (see patch 3) > > */ > - public function __construct($viewCount = null, $watchCount = null) > + public function __construct($viewCount = null, $videoWatchCount = null, > + $subscriberCount = null, $lastWebAccess = null,
Sign in to reply to this message.
|