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.
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
25 * @see Zend_Gdata_App_Extension
27 require_once 'Zend/Gdata/App/Extension.php';
30 * Represents the YouTube specific media:credit element
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_YouTube_Extension_MediaCredit extends Zend_Gdata_Extension
41 protected $_rootElement = 'credit';
42 protected $_rootNamespace = 'media';
47 protected $_role = null;
52 protected $_scheme = null;
55 * Represents the value of the yt:type attribute.
57 * Set to 'partner' if the uploader of this video is a YouTube
62 protected $_yttype = null;
65 * Creates an individual MediaCredit object.
69 * @param string $scheme
71 public function __construct($text = null, $role = null, $scheme = null,
74 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
75 parent::__construct();
78 $this->_scheme = $scheme;
79 $this->_yttype = $yttype;
83 * Retrieves a DOMElement which corresponds to this element and all
84 * child properties. This is used to build an entry back into a DOM
85 * and eventually XML text for sending to the server upon updates, or
86 * for application storage/persistence.
88 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
89 * @return DOMElement The DOMElement representing this element and all
92 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
94 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
95 if ($this->_role !== null) {
96 $element->setAttribute('role', $this->_role);
98 if ($this->_scheme !== null) {
99 $element->setAttribute('scheme', $this->_scheme);
101 if ($this->_yttype !== null) {
102 $element->setAttributeNS('http://gdata.youtube.com/schemas/2007',
103 'yt:type', $this->_yttype);
109 * Given a DOMNode representing an attribute, tries to map the data into
110 * instance members. If no mapping is defined, the name and value are
111 * stored in an array.
113 * @param DOMNode $attribute The DOMNode attribute needed to be handled
115 protected function takeAttributeFromDOM($attribute)
117 switch ($attribute->localName) {
119 $this->_role = $attribute->nodeValue;
122 $this->_scheme = $attribute->nodeValue;
125 $this->_yttype = $attribute->nodeValue;
128 parent::takeAttributeFromDOM($attribute);
135 public function getRole()
141 * @param string $value
142 * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent
145 public function setRole($value)
147 $this->_role = $value;
154 public function getScheme()
156 return $this->_scheme;
160 * @param string $value
161 * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent
164 public function setScheme($value)
166 $this->_scheme = $value;
173 public function getYTtype()
175 return $this->_yttype;
179 * @param string $value
180 * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent
183 public function setYTtype($value)
185 $this->_yttype = $value;