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_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * Data model for representing an atom:link 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_App_Extension_Link extends Zend_Gdata_App_Extension
41 protected $_rootElement = 'link';
42 protected $_href = null;
43 protected $_rel = null;
44 protected $_type = null;
45 protected $_hrefLang = null;
46 protected $_title = null;
47 protected $_length = null;
49 public function __construct($href = null, $rel = null, $type = null,
50 $hrefLang = null, $title = null, $length = null)
52 parent::__construct();
56 $this->_hrefLang = $hrefLang;
57 $this->_title = $title;
58 $this->_length = $length;
61 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
63 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
64 if ($this->_href !== null) {
65 $element->setAttribute('href', $this->_href);
67 if ($this->_rel !== null) {
68 $element->setAttribute('rel', $this->_rel);
70 if ($this->_type !== null) {
71 $element->setAttribute('type', $this->_type);
73 if ($this->_hrefLang !== null) {
74 $element->setAttribute('hreflang', $this->_hrefLang);
76 if ($this->_title !== null) {
77 $element->setAttribute('title', $this->_title);
79 if ($this->_length !== null) {
80 $element->setAttribute('length', $this->_length);
85 protected function takeAttributeFromDOM($attribute)
87 switch ($attribute->localName) {
89 $this->_href = $attribute->nodeValue;
92 $this->_rel = $attribute->nodeValue;
95 $this->_type = $attribute->nodeValue;
98 $this->_hrefLang = $attribute->nodeValue;
101 $this->_title = $attribute->nodeValue;
104 $this->_length = $attribute->nodeValue;
107 parent::takeAttributeFromDOM($attribute);
112 * @return string|null
114 public function getHref()
120 * @param string|null $value
121 * @return Zend_Gdata_App_Entry Provides a fluent interface
123 public function setHref($value)
125 $this->_href = $value;
130 * @return string|null
132 public function getRel()
138 * @param string|null $value
139 * @return Zend_Gdata_App_Entry Provides a fluent interface
141 public function setRel($value)
143 $this->_rel = $value;
148 * @return string|null
150 public function getType()
156 * @param string|null $value
157 * @return Zend_Gdata_App_Entry Provides a fluent interface
159 public function setType($value)
161 $this->_type = $value;
166 * @return string|null
168 public function getHrefLang()
170 return $this->_hrefLang;
174 * @param string|null $value
175 * @return Zend_Gdata_App_Entry Provides a fluent interface
177 public function setHrefLang($value)
179 $this->_hrefLang = $value;
184 * @return string|null
186 public function getTitle()
188 return $this->_title;
192 * @param string|null $value
193 * @return Zend_Gdata_App_Entry Provides a fluent interface
195 public function setTitle($value)
197 $this->_title = $value;
202 * @return string|null
204 public function getLength()
206 return $this->_length;
210 * @param string|null $value
211 * @return Zend_Gdata_App_Entry Provides a fluent interface
213 public function setLength($value)
215 $this->_length = $value;