UserProfileEntry.php 29 KB

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