2
0

UserProfileEntry.php 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040
  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 YouTube
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Gdata_Entry
  23. */
  24. require_once 'Zend/Gdata/Entry.php';
  25. /**
  26. * @see Zend_Gdata_Extension_FeedLink
  27. */
  28. require_once 'Zend/Gdata/Extension/FeedLink.php';
  29. /**
  30. * @see Zend_Gdata_YouTube_Extension_Description
  31. */
  32. require_once 'Zend/Gdata/YouTube/Extension/Description.php';
  33. /**
  34. * @see Zend_Gdata_YouTube_Extension_AboutMe
  35. */
  36. require_once 'Zend/Gdata/YouTube/Extension/AboutMe.php';
  37. /**
  38. * @see Zend_Gdata_YouTube_Extension_Age
  39. */
  40. require_once 'Zend/Gdata/YouTube/Extension/Age.php';
  41. /**
  42. * @see Zend_Gdata_YouTube_Extension_Username
  43. */
  44. require_once 'Zend/Gdata/YouTube/Extension/Username.php';
  45. /**
  46. * @see Zend_Gdata_YouTube_Extension_Books
  47. */
  48. require_once 'Zend/Gdata/YouTube/Extension/Books.php';
  49. /**
  50. * @see Zend_Gdata_YouTube_Extension_Company
  51. */
  52. require_once 'Zend/Gdata/YouTube/Extension/Company.php';
  53. /**
  54. * @see Zend_Gdata_YouTube_Extension_Hobbies
  55. */
  56. require_once 'Zend/Gdata/YouTube/Extension/Hobbies.php';
  57. /**
  58. * @see Zend_Gdata_YouTube_Extension_Hometown
  59. */
  60. require_once 'Zend/Gdata/YouTube/Extension/Hometown.php';
  61. /**
  62. * @see Zend_Gdata_YouTube_Extension_Location
  63. */
  64. require_once 'Zend/Gdata/YouTube/Extension/Location.php';
  65. /**
  66. * @see Zend_Gdata_YouTube_Extension_Movies
  67. */
  68. require_once 'Zend/Gdata/YouTube/Extension/Movies.php';
  69. /**
  70. * @see Zend_Gdata_YouTube_Extension_Music
  71. */
  72. require_once 'Zend/Gdata/YouTube/Extension/Music.php';
  73. /**
  74. * @see Zend_Gdata_YouTube_Extension_Occupation
  75. */
  76. require_once 'Zend/Gdata/YouTube/Extension/Occupation.php';
  77. /**
  78. * @see Zend_Gdata_YouTube_Extension_School
  79. */
  80. require_once 'Zend/Gdata/YouTube/Extension/School.php';
  81. /**
  82. * @see Zend_Gdata_YouTube_Extension_Gender
  83. */
  84. require_once 'Zend/Gdata/YouTube/Extension/Gender.php';
  85. /**
  86. * @see Zend_Gdata_YouTube_Extension_Relationship
  87. */
  88. require_once 'Zend/Gdata/YouTube/Extension/Relationship.php';
  89. /**
  90. * @see Zend_Gdata_YouTube_Extension_FirstName
  91. */
  92. require_once 'Zend/Gdata/YouTube/Extension/FirstName.php';
  93. /**
  94. * @see Zend_Gdata_YouTube_Extension_LastName
  95. */
  96. require_once 'Zend/Gdata/YouTube/Extension/LastName.php';
  97. /**
  98. * @see Zend_Gdata_YouTube_Extension_Statistics
  99. */
  100. require_once 'Zend/Gdata/YouTube/Extension/Statistics.php';
  101. /**
  102. * @see Zend_Gdata_Media_Extension_MediaThumbnail
  103. */
  104. require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php';
  105. /**
  106. * Represents the YouTube video playlist flavor of an Atom entry
  107. *
  108. * @category Zend
  109. * @package Zend_Gdata
  110. * @subpackage YouTube
  111. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  112. * @license http://framework.zend.com/license/new-bsd New BSD License
  113. */
  114. class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry
  115. {
  116. protected $_entryClassName = 'Zend_Gdata_YouTube_UserProfileEntry';
  117. /**
  118. * Nested feed links
  119. *
  120. * @var array
  121. */
  122. protected $_feedLink = array();
  123. /**
  124. * The username for this profile entry
  125. *
  126. * @var string
  127. */
  128. protected $_username = null;
  129. /**
  130. * The description of the user
  131. *
  132. * @var string
  133. */
  134. protected $_description = null;
  135. /**
  136. * The contents of the 'About Me' field.
  137. *
  138. * @var string
  139. */
  140. protected $_aboutMe = null;
  141. /**
  142. * The age of the user
  143. *
  144. * @var int
  145. */
  146. protected $_age = null;
  147. /**
  148. * Books of interest to the user
  149. *
  150. * @var string
  151. */
  152. protected $_books = null;
  153. /**
  154. * Company
  155. *
  156. * @var string
  157. */
  158. protected $_company = null;
  159. /**
  160. * Hobbies
  161. *
  162. * @var string
  163. */
  164. protected $_hobbies = null;
  165. /**
  166. * Hometown
  167. *
  168. * @var string
  169. */
  170. protected $_hometown = null;
  171. /**
  172. * Location
  173. *
  174. * @var string
  175. */
  176. protected $_location = null;
  177. /**
  178. * Movies
  179. *
  180. * @var string
  181. */
  182. protected $_movies = null;
  183. /**
  184. * Music
  185. *
  186. * @var string
  187. */
  188. protected $_music = null;
  189. /**
  190. * Occupation
  191. *
  192. * @var string
  193. */
  194. protected $_occupation = null;
  195. /**
  196. * School
  197. *
  198. * @var string
  199. */
  200. protected $_school = null;
  201. /**
  202. * Gender
  203. *
  204. * @var string
  205. */
  206. protected $_gender = null;
  207. /**
  208. * Relationship
  209. *
  210. * @var string
  211. */
  212. protected $_relationship = null;
  213. /**
  214. * First name
  215. *
  216. * @var string
  217. */
  218. protected $_firstName = null;
  219. /**
  220. * Last name
  221. *
  222. * @var string
  223. */
  224. protected $_lastName = null;
  225. /**
  226. * Statistics
  227. *
  228. * @var Zend_Gdata_YouTube_Extension_Statistics
  229. */
  230. protected $_statistics = null;
  231. /**
  232. * Thumbnail
  233. *
  234. * @var Zend_Gdata_Media_Extension_MediaThumbnail
  235. */
  236. protected $_thumbnail = null;
  237. /**
  238. * Creates a User Profile entry, representing an individual user
  239. * and their attributes.
  240. *
  241. * @param DOMElement $element (optional) DOMElement from which this
  242. * object should be constructed.
  243. */
  244. public function __construct($element = null)
  245. {
  246. $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
  247. parent::__construct($element);
  248. }
  249. /**
  250. * Retrieves a DOMElement which corresponds to this element and all
  251. * child properties. This is used to build an entry back into a DOM
  252. * and eventually XML text for sending to the server upon updates, or
  253. * for application storage/persistence.
  254. *
  255. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  256. * @return DOMElement The DOMElement representing this element and all
  257. * child properties.
  258. */
  259. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  260. {
  261. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  262. if ($this->_description != null) {
  263. $element->appendChild($this->_description->getDOM($element->ownerDocument));
  264. }
  265. if ($this->_aboutMe != null) {
  266. $element->appendChild($this->_aboutMe->getDOM($element->ownerDocument));
  267. }
  268. if ($this->_age != null) {
  269. $element->appendChild($this->_age->getDOM($element->ownerDocument));
  270. }
  271. if ($this->_username != null) {
  272. $element->appendChild($this->_username->getDOM($element->ownerDocument));
  273. }
  274. if ($this->_books != null) {
  275. $element->appendChild($this->_books->getDOM($element->ownerDocument));
  276. }
  277. if ($this->_company != null) {
  278. $element->appendChild($this->_company->getDOM($element->ownerDocument));
  279. }
  280. if ($this->_hobbies != null) {
  281. $element->appendChild($this->_hobbies->getDOM($element->ownerDocument));
  282. }
  283. if ($this->_hometown != null) {
  284. $element->appendChild($this->_hometown->getDOM($element->ownerDocument));
  285. }
  286. if ($this->_location != null) {
  287. $element->appendChild($this->_location->getDOM($element->ownerDocument));
  288. }
  289. if ($this->_movies != null) {
  290. $element->appendChild($this->_movies->getDOM($element->ownerDocument));
  291. }
  292. if ($this->_music != null) {
  293. $element->appendChild($this->_music->getDOM($element->ownerDocument));
  294. }
  295. if ($this->_occupation != null) {
  296. $element->appendChild($this->_occupation->getDOM($element->ownerDocument));
  297. }
  298. if ($this->_school != null) {
  299. $element->appendChild($this->_school->getDOM($element->ownerDocument));
  300. }
  301. if ($this->_gender != null) {
  302. $element->appendChild($this->_gender->getDOM($element->ownerDocument));
  303. }
  304. if ($this->_relationship != null) {
  305. $element->appendChild($this->_relationship->getDOM($element->ownerDocument));
  306. }
  307. if ($this->_firstName != null) {
  308. $element->appendChild($this->_firstName->getDOM($element->ownerDocument));
  309. }
  310. if ($this->_lastName != null) {
  311. $element->appendChild($this->_lastName->getDOM($element->ownerDocument));
  312. }
  313. if ($this->_statistics != null) {
  314. $element->appendChild($this->_statistics->getDOM($element->ownerDocument));
  315. }
  316. if ($this->_thumbnail != null) {
  317. $element->appendChild($this->_thumbnail->getDOM($element->ownerDocument));
  318. }
  319. if ($this->_feedLink != null) {
  320. foreach ($this->_feedLink as $feedLink) {
  321. $element->appendChild($feedLink->getDOM($element->ownerDocument));
  322. }
  323. }
  324. return $element;
  325. }
  326. /**
  327. * Creates individual Entry objects of the appropriate type and
  328. * stores them in the $_entry array based upon DOM data.
  329. *
  330. * @param DOMNode $child The DOMNode to process
  331. */
  332. protected function takeChildFromDOM($child)
  333. {
  334. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  335. switch ($absoluteNodeName) {
  336. case $this->lookupNamespace('yt') . ':' . 'description':
  337. $description = new Zend_Gdata_YouTube_Extension_Description();
  338. $description->transferFromDOM($child);
  339. $this->_description = $description;
  340. break;
  341. case $this->lookupNamespace('yt') . ':' . 'aboutMe':
  342. $aboutMe = new Zend_Gdata_YouTube_Extension_AboutMe();
  343. $aboutMe->transferFromDOM($child);
  344. $this->_aboutMe = $aboutMe;
  345. break;
  346. case $this->lookupNamespace('yt') . ':' . 'age':
  347. $age = new Zend_Gdata_YouTube_Extension_Age();
  348. $age->transferFromDOM($child);
  349. $this->_age = $age;
  350. break;
  351. case $this->lookupNamespace('yt') . ':' . 'username':
  352. $username = new Zend_Gdata_YouTube_Extension_Username();
  353. $username->transferFromDOM($child);
  354. $this->_username = $username;
  355. break;
  356. case $this->lookupNamespace('yt') . ':' . 'books':
  357. $books = new Zend_Gdata_YouTube_Extension_Books();
  358. $books->transferFromDOM($child);
  359. $this->_books = $books;
  360. break;
  361. case $this->lookupNamespace('yt') . ':' . 'company':
  362. $company = new Zend_Gdata_YouTube_Extension_Company();
  363. $company->transferFromDOM($child);
  364. $this->_company = $company;
  365. break;
  366. case $this->lookupNamespace('yt') . ':' . 'hobbies':
  367. $hobbies = new Zend_Gdata_YouTube_Extension_Hobbies();
  368. $hobbies->transferFromDOM($child);
  369. $this->_hobbies = $hobbies;
  370. break;
  371. case $this->lookupNamespace('yt') . ':' . 'hometown':
  372. $hometown = new Zend_Gdata_YouTube_Extension_Hometown();
  373. $hometown->transferFromDOM($child);
  374. $this->_hometown = $hometown;
  375. break;
  376. case $this->lookupNamespace('yt') . ':' . 'location':
  377. $location = new Zend_Gdata_YouTube_Extension_Location();
  378. $location->transferFromDOM($child);
  379. $this->_location = $location;
  380. break;
  381. case $this->lookupNamespace('yt') . ':' . 'movies':
  382. $movies = new Zend_Gdata_YouTube_Extension_Movies();
  383. $movies->transferFromDOM($child);
  384. $this->_movies = $movies;
  385. break;
  386. case $this->lookupNamespace('yt') . ':' . 'music':
  387. $music = new Zend_Gdata_YouTube_Extension_Music();
  388. $music->transferFromDOM($child);
  389. $this->_music = $music;
  390. break;
  391. case $this->lookupNamespace('yt') . ':' . 'occupation':
  392. $occupation = new Zend_Gdata_YouTube_Extension_Occupation();
  393. $occupation->transferFromDOM($child);
  394. $this->_occupation = $occupation;
  395. break;
  396. case $this->lookupNamespace('yt') . ':' . 'school':
  397. $school = new Zend_Gdata_YouTube_Extension_School();
  398. $school->transferFromDOM($child);
  399. $this->_school = $school;
  400. break;
  401. case $this->lookupNamespace('yt') . ':' . 'gender':
  402. $gender = new Zend_Gdata_YouTube_Extension_Gender();
  403. $gender->transferFromDOM($child);
  404. $this->_gender = $gender;
  405. break;
  406. case $this->lookupNamespace('yt') . ':' . 'relationship':
  407. $relationship = new Zend_Gdata_YouTube_Extension_Relationship();
  408. $relationship->transferFromDOM($child);
  409. $this->_relationship = $relationship;
  410. break;
  411. case $this->lookupNamespace('yt') . ':' . 'firstName':
  412. $firstName = new Zend_Gdata_YouTube_Extension_FirstName();
  413. $firstName->transferFromDOM($child);
  414. $this->_firstName = $firstName;
  415. break;
  416. case $this->lookupNamespace('yt') . ':' . 'lastName':
  417. $lastName = new Zend_Gdata_YouTube_Extension_LastName();
  418. $lastName->transferFromDOM($child);
  419. $this->_lastName = $lastName;
  420. break;
  421. case $this->lookupNamespace('yt') . ':' . 'statistics':
  422. $statistics = new Zend_Gdata_YouTube_Extension_Statistics();
  423. $statistics->transferFromDOM($child);
  424. $this->_statistics = $statistics;
  425. break;
  426. case $this->lookupNamespace('media') . ':' . 'thumbnail':
  427. $thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail();
  428. $thumbnail->transferFromDOM($child);
  429. $this->_thumbnail = $thumbnail;
  430. break;
  431. case $this->lookupNamespace('gd') . ':' . 'feedLink':
  432. $feedLink = new Zend_Gdata_Extension_FeedLink();
  433. $feedLink->transferFromDOM($child);
  434. $this->_feedLink[] = $feedLink;
  435. break;
  436. default:
  437. parent::takeChildFromDOM($child);
  438. break;
  439. }
  440. }
  441. /**
  442. * Sets the content of the 'about me' field.
  443. *
  444. * @param Zend_Gdata_YouTube_Extension_AboutMe $aboutMe The 'about me'
  445. * information.
  446. * @throws Zend_Gdata_App_VersionException
  447. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  448. */
  449. public function setAboutMe($aboutMe = null)
  450. {
  451. if (($this->getMajorProtocolVersion() == null) ||
  452. ($this->getMajorProtocolVersion() == 1)) {
  453. require_once 'Zend/Gdata/App/VersionException.php';
  454. throw new Zend_Gdata_App_VersionException('The setAboutMe ' .
  455. ' method is only supported as of version 2 of the YouTube ' .
  456. 'API.');
  457. } else {
  458. $this->_aboutMe = $aboutMe;
  459. return $this;
  460. }
  461. }
  462. /**
  463. * Returns the contents of the 'about me' field.
  464. *
  465. * @throws Zend_Gdata_App_VersionException
  466. * @return Zend_Gdata_YouTube_Extension_AboutMe The 'about me' information
  467. */
  468. public function getAboutMe()
  469. {
  470. if (($this->getMajorProtocolVersion() == null) ||
  471. ($this->getMajorProtocolVersion() == 1)) {
  472. require_once 'Zend/Gdata/App/VersionException.php';
  473. throw new Zend_Gdata_App_VersionException('The getAboutMe ' .
  474. ' method is only supported as of version 2 of the YouTube ' .
  475. 'API.');
  476. } else {
  477. return $this->_aboutMe;
  478. }
  479. }
  480. /**
  481. * Sets the content of the 'first name' field.
  482. *
  483. * @param Zend_Gdata_YouTube_Extension_FirstName $firstName The first name
  484. * @throws Zend_Gdata_App_VersionException
  485. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  486. */
  487. public function setFirstName($firstName = null)
  488. {
  489. if (($this->getMajorProtocolVersion() == null) ||
  490. ($this->getMajorProtocolVersion() == 1)) {
  491. require_once 'Zend/Gdata/App/VersionException.php';
  492. throw new Zend_Gdata_App_VersionException('The setFirstName ' .
  493. ' method is only supported as of version 2 of the YouTube ' .
  494. 'API.');
  495. } else {
  496. $this->_firstName = $firstName;
  497. return $this;
  498. }
  499. }
  500. /**
  501. * Returns the first name
  502. *
  503. * @throws Zend_Gdata_App_VersionException
  504. * @return Zend_Gdata_YouTube_Extension_FirstName The first name
  505. */
  506. public function getFirstName()
  507. {
  508. if (($this->getMajorProtocolVersion() == null) ||
  509. ($this->getMajorProtocolVersion() == 1)) {
  510. require_once 'Zend/Gdata/App/VersionException.php';
  511. throw new Zend_Gdata_App_VersionException('The getFirstName ' .
  512. ' method is only supported as of version 2 of the YouTube ' .
  513. 'API.');
  514. } else {
  515. return $this->_firstName;
  516. }
  517. }
  518. /**
  519. * Sets the content of the 'last name' field.
  520. *
  521. * @param Zend_Gdata_YouTube_Extension_LastName $lastName The last name
  522. * @throws Zend_Gdata_App_VersionException
  523. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  524. */
  525. public function setLastName($lastName = null)
  526. {
  527. if (($this->getMajorProtocolVersion() == null) ||
  528. ($this->getMajorProtocolVersion() == 1)) {
  529. require_once 'Zend/Gdata/App/VersionException.php';
  530. throw new Zend_Gdata_App_VersionException('The setLastName ' .
  531. ' method is only supported as of version 2 of the YouTube ' .
  532. 'API.');
  533. } else {
  534. $this->_lastName = $lastName;
  535. return $this;
  536. }
  537. }
  538. /**
  539. * Returns the last name
  540. *
  541. * @throws Zend_Gdata_App_VersionException
  542. * @return Zend_Gdata_YouTube_Extension_LastName The last name
  543. */
  544. public function getLastName()
  545. {
  546. if (($this->getMajorProtocolVersion() == null) ||
  547. ($this->getMajorProtocolVersion() == 1)) {
  548. require_once 'Zend/Gdata/App/VersionException.php';
  549. throw new Zend_Gdata_App_VersionException('The getLastName ' .
  550. ' method is only supported as of version 2 of the YouTube ' .
  551. 'API.');
  552. } else {
  553. return $this->_lastName;
  554. }
  555. }
  556. /**
  557. * Returns the statistics
  558. *
  559. * @throws Zend_Gdata_App_VersionException
  560. * @return Zend_Gdata_YouTube_Extension_Statistics The profile statistics
  561. */
  562. public function getStatistics()
  563. {
  564. if (($this->getMajorProtocolVersion() == null) ||
  565. ($this->getMajorProtocolVersion() == 1)) {
  566. require_once 'Zend/Gdata/App/VersionException.php';
  567. throw new Zend_Gdata_App_VersionException('The getStatistics ' .
  568. ' method is only supported as of version 2 of the YouTube ' .
  569. 'API.');
  570. } else {
  571. return $this->_statistics;
  572. }
  573. }
  574. /**
  575. * Returns the thumbnail
  576. *
  577. * @throws Zend_Gdata_App_VersionException
  578. * @return Zend_Gdata_Media_Extension_MediaThumbnail The profile thumbnail
  579. */
  580. public function getThumbnail()
  581. {
  582. if (($this->getMajorProtocolVersion() == null) ||
  583. ($this->getMajorProtocolVersion() == 1)) {
  584. require_once 'Zend/Gdata/App/VersionException.php';
  585. throw new Zend_Gdata_App_VersionException('The getThumbnail ' .
  586. ' method is only supported as of version 2 of the YouTube ' .
  587. 'API.');
  588. } else {
  589. return $this->_thumbnail;
  590. }
  591. }
  592. /**
  593. * Sets the age
  594. *
  595. * @param Zend_Gdata_YouTube_Extension_Age $age The age
  596. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  597. */
  598. public function setAge($age = null)
  599. {
  600. $this->_age = $age;
  601. return $this;
  602. }
  603. /**
  604. * Returns the age
  605. *
  606. * @return Zend_Gdata_YouTube_Extension_Age The age
  607. */
  608. public function getAge()
  609. {
  610. return $this->_age;
  611. }
  612. /**
  613. * Sets the username
  614. *
  615. * @param Zend_Gdata_YouTube_Extension_Username $username The username
  616. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  617. */
  618. public function setUsername($username = null)
  619. {
  620. $this->_username = $username;
  621. return $this;
  622. }
  623. /**
  624. * Returns the username
  625. *
  626. * @return Zend_Gdata_YouTube_Extension_Username The username
  627. */
  628. public function getUsername()
  629. {
  630. return $this->_username;
  631. }
  632. /**
  633. * Sets the books
  634. *
  635. * @param Zend_Gdata_YouTube_Extension_Books $books The books
  636. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  637. */
  638. public function setBooks($books = null)
  639. {
  640. $this->_books = $books;
  641. return $this;
  642. }
  643. /**
  644. * Returns the books
  645. *
  646. * @return Zend_Gdata_YouTube_Extension_Books The books
  647. */
  648. public function getBooks()
  649. {
  650. return $this->_books;
  651. }
  652. /**
  653. * Sets the company
  654. *
  655. * @param Zend_Gdata_YouTube_Extension_Company $company The company
  656. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  657. */
  658. public function setCompany($company = null)
  659. {
  660. $this->_company = $company;
  661. return $this;
  662. }
  663. /**
  664. * Returns the company
  665. *
  666. * @return Zend_Gdata_YouTube_Extension_Company The company
  667. */
  668. public function getCompany()
  669. {
  670. return $this->_company;
  671. }
  672. /**
  673. * Sets the hobbies
  674. *
  675. * @param Zend_Gdata_YouTube_Extension_Hobbies $hobbies The hobbies
  676. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  677. */
  678. public function setHobbies($hobbies = null)
  679. {
  680. $this->_hobbies = $hobbies;
  681. return $this;
  682. }
  683. /**
  684. * Returns the hobbies
  685. *
  686. * @return Zend_Gdata_YouTube_Extension_Hobbies The hobbies
  687. */
  688. public function getHobbies()
  689. {
  690. return $this->_hobbies;
  691. }
  692. /**
  693. * Sets the hometown
  694. *
  695. * @param Zend_Gdata_YouTube_Extension_Hometown $hometown The hometown
  696. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  697. */
  698. public function setHometown($hometown = null)
  699. {
  700. $this->_hometown = $hometown;
  701. return $this;
  702. }
  703. /**
  704. * Returns the hometown
  705. *
  706. * @return Zend_Gdata_YouTube_Extension_Hometown The hometown
  707. */
  708. public function getHometown()
  709. {
  710. return $this->_hometown;
  711. }
  712. /**
  713. * Sets the location
  714. *
  715. * @param Zend_Gdata_YouTube_Extension_Location $location The location
  716. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  717. */
  718. public function setLocation($location = null)
  719. {
  720. $this->_location = $location;
  721. return $this;
  722. }
  723. /**
  724. * Returns the location
  725. *
  726. * @return Zend_Gdata_YouTube_Extension_Location The location
  727. */
  728. public function getLocation()
  729. {
  730. return $this->_location;
  731. }
  732. /**
  733. * Sets the movies
  734. *
  735. * @param Zend_Gdata_YouTube_Extension_Movies $movies The movies
  736. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  737. */
  738. public function setMovies($movies = null)
  739. {
  740. $this->_movies = $movies;
  741. return $this;
  742. }
  743. /**
  744. * Returns the movies
  745. *
  746. * @return Zend_Gdata_YouTube_Extension_Movies The movies
  747. */
  748. public function getMovies()
  749. {
  750. return $this->_movies;
  751. }
  752. /**
  753. * Sets the music
  754. *
  755. * @param Zend_Gdata_YouTube_Extension_Music $music The music
  756. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  757. */
  758. public function setMusic($music = null)
  759. {
  760. $this->_music = $music;
  761. return $this;
  762. }
  763. /**
  764. * Returns the music
  765. *
  766. * @return Zend_Gdata_YouTube_Extension_Music The music
  767. */
  768. public function getMusic()
  769. {
  770. return $this->_music;
  771. }
  772. /**
  773. * Sets the occupation
  774. *
  775. * @param Zend_Gdata_YouTube_Extension_Occupation $occupation The occupation
  776. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  777. */
  778. public function setOccupation($occupation = null)
  779. {
  780. $this->_occupation = $occupation;
  781. return $this;
  782. }
  783. /**
  784. * Returns the occupation
  785. *
  786. * @return Zend_Gdata_YouTube_Extension_Occupation The occupation
  787. */
  788. public function getOccupation()
  789. {
  790. return $this->_occupation;
  791. }
  792. /**
  793. * Sets the school
  794. *
  795. * @param Zend_Gdata_YouTube_Extension_School $school The school
  796. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  797. */
  798. public function setSchool($school = null)
  799. {
  800. $this->_school = $school;
  801. return $this;
  802. }
  803. /**
  804. * Returns the school
  805. *
  806. * @return Zend_Gdata_YouTube_Extension_School The school
  807. */
  808. public function getSchool()
  809. {
  810. return $this->_school;
  811. }
  812. /**
  813. * Sets the gender
  814. *
  815. * @param Zend_Gdata_YouTube_Extension_Gender $gender The gender
  816. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  817. */
  818. public function setGender($gender = null)
  819. {
  820. $this->_gender = $gender;
  821. return $this;
  822. }
  823. /**
  824. * Returns the gender
  825. *
  826. * @return Zend_Gdata_YouTube_Extension_Gender The gender
  827. */
  828. public function getGender()
  829. {
  830. return $this->_gender;
  831. }
  832. /**
  833. * Sets the relationship
  834. *
  835. * @param Zend_Gdata_YouTube_Extension_Relationship $relationship The relationship
  836. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  837. */
  838. public function setRelationship($relationship = null)
  839. {
  840. $this->_relationship = $relationship;
  841. return $this;
  842. }
  843. /**
  844. * Returns the relationship
  845. *
  846. * @return Zend_Gdata_YouTube_Extension_Relationship The relationship
  847. */
  848. public function getRelationship()
  849. {
  850. return $this->_relationship;
  851. }
  852. /**
  853. * Sets the array of embedded feeds related to the video
  854. *
  855. * @param array $feedLink The array of embedded feeds relating to the video
  856. * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface
  857. */
  858. public function setFeedLink($feedLink = null)
  859. {
  860. $this->_feedLink = $feedLink;
  861. return $this;
  862. }
  863. /**
  864. * Get the feed link property for this entry.
  865. *
  866. * @see setFeedLink
  867. * @param string $rel (optional) The rel value of the link to be found.
  868. * If null, the array of links is returned.
  869. * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink
  870. * object corresponding to the requested rel value is returned
  871. * if found, or null if the requested value is not found. If
  872. * $rel is null or not specified, an array of all available
  873. * feed links for this entry is returned, or null if no feed
  874. * links are set.
  875. */
  876. public function getFeedLink($rel = null)
  877. {
  878. if ($rel == null) {
  879. return $this->_feedLink;
  880. } else {
  881. foreach ($this->_feedLink as $feedLink) {
  882. if ($feedLink->rel == $rel) {
  883. return $feedLink;
  884. }
  885. }
  886. return null;
  887. }
  888. }
  889. /**
  890. * Returns the URL in the gd:feedLink with the provided rel value
  891. *
  892. * @param string $rel The rel value to find
  893. * @return mixed Either the URL as a string or null if a feedLink wasn't
  894. * found with the provided rel value
  895. */
  896. public function getFeedLinkHref($rel)
  897. {
  898. $feedLink = $this->getFeedLink($rel);
  899. if ($feedLink !== null) {
  900. return $feedLink->href;
  901. } else {
  902. return null;
  903. }
  904. }
  905. /**
  906. * Returns the URL of the playlist list feed
  907. *
  908. * @return string The URL of the playlist video feed
  909. */
  910. public function getPlaylistListFeedUrl()
  911. {
  912. return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_PLAYLISTS_REL);
  913. }
  914. /**
  915. * Returns the URL of the uploads feed
  916. *
  917. * @return string The URL of the uploads video feed
  918. */
  919. public function getUploadsFeedUrl()
  920. {
  921. return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_UPLOADS_REL);
  922. }
  923. /**
  924. * Returns the URL of the subscriptions feed
  925. *
  926. * @return string The URL of the subscriptions feed
  927. */
  928. public function getSubscriptionsFeedUrl()
  929. {
  930. return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_SUBSCRIPTIONS_REL);
  931. }
  932. /**
  933. * Returns the URL of the contacts feed
  934. *
  935. * @return string The URL of the contacts feed
  936. */
  937. public function getContactsFeedUrl()
  938. {
  939. return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_CONTACTS_REL);
  940. }
  941. /**
  942. * Returns the URL of the favorites feed
  943. *
  944. * @return string The URL of the favorites feed
  945. */
  946. public function getFavoritesFeedUrl()
  947. {
  948. return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_FAVORITES_REL);
  949. }
  950. }