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