File indexing completed on 2025-03-02 05:29:25

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage App
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Extension
0026  */
0027 // require_once 'Zend/Gdata/Extension.php';
0028 
0029 /**
0030  * Data model for representing an atom:link element
0031  *
0032  * @category   Zend
0033  * @package    Zend_Gdata
0034  * @subpackage App
0035  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0036  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0037  */
0038 class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension
0039 {
0040 
0041     protected $_rootElement = 'link';
0042     protected $_href = null;
0043     protected $_rel = null;
0044     protected $_type = null;
0045     protected $_hrefLang = null;
0046     protected $_title = null;
0047     protected $_length = null;
0048 
0049     public function __construct($href = null, $rel = null, $type = null,
0050             $hrefLang = null, $title = null, $length = null)
0051     {
0052         parent::__construct();
0053         $this->_href = $href;
0054         $this->_rel = $rel;
0055         $this->_type = $type;
0056         $this->_hrefLang = $hrefLang;
0057         $this->_title = $title;
0058         $this->_length = $length;
0059     }
0060 
0061     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0062     {
0063         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0064         if ($this->_href !== null) {
0065             $element->setAttribute('href', $this->_href);
0066         }
0067         if ($this->_rel !== null) {
0068             $element->setAttribute('rel', $this->_rel);
0069         }
0070         if ($this->_type !== null) {
0071             $element->setAttribute('type', $this->_type);
0072         }
0073         if ($this->_hrefLang !== null) {
0074             $element->setAttribute('hreflang', $this->_hrefLang);
0075         }
0076         if ($this->_title !== null) {
0077             $element->setAttribute('title', $this->_title);
0078         }
0079         if ($this->_length !== null) {
0080             $element->setAttribute('length', $this->_length);
0081         }
0082         return $element;
0083     }
0084 
0085     protected function takeAttributeFromDOM($attribute)
0086     {
0087         switch ($attribute->localName) {
0088         case 'href':
0089             $this->_href = $attribute->nodeValue;
0090             break;
0091         case 'rel':
0092             $this->_rel = $attribute->nodeValue;
0093             break;
0094         case 'type':
0095             $this->_type = $attribute->nodeValue;
0096             break;
0097         case 'hreflang':
0098             $this->_hrefLang = $attribute->nodeValue;
0099             break;
0100         case 'title':
0101             $this->_title = $attribute->nodeValue;
0102             break;
0103         case 'length':
0104             $this->_length = $attribute->nodeValue;
0105             break;
0106         default:
0107             parent::takeAttributeFromDOM($attribute);
0108         }
0109     }
0110 
0111     /**
0112      * @return string|null
0113      */
0114     public function getHref()
0115     {
0116         return $this->_href;
0117     }
0118 
0119     /**
0120      * @param string|null $value
0121      * @return Zend_Gdata_App_Entry Provides a fluent interface
0122      */
0123     public function setHref($value)
0124     {
0125         $this->_href = $value;
0126         return $this;
0127     }
0128 
0129     /**
0130      * @return string|null
0131      */
0132     public function getRel()
0133     {
0134         return $this->_rel;
0135     }
0136 
0137     /**
0138      * @param string|null $value
0139      * @return Zend_Gdata_App_Entry Provides a fluent interface
0140      */
0141     public function setRel($value)
0142     {
0143         $this->_rel = $value;
0144         return $this;
0145     }
0146 
0147     /**
0148      * @return string|null
0149      */
0150     public function getType()
0151     {
0152         return $this->_type;
0153     }
0154 
0155     /**
0156      * @param string|null $value
0157      * @return Zend_Gdata_App_Entry Provides a fluent interface
0158      */
0159     public function setType($value)
0160     {
0161         $this->_type = $value;
0162         return $this;
0163     }
0164 
0165     /**
0166      * @return string|null
0167      */
0168     public function getHrefLang()
0169     {
0170         return $this->_hrefLang;
0171     }
0172 
0173     /**
0174      * @param string|null $value
0175      * @return Zend_Gdata_App_Entry Provides a fluent interface
0176      */
0177     public function setHrefLang($value)
0178     {
0179         $this->_hrefLang = $value;
0180         return $this;
0181     }
0182 
0183     /**
0184      * @return string|null
0185      */
0186     public function getTitle()
0187     {
0188         return $this->_title;
0189     }
0190 
0191     /**
0192      * @param string|null $value
0193      * @return Zend_Gdata_App_Entry Provides a fluent interface
0194      */
0195     public function setTitle($value)
0196     {
0197         $this->_title = $value;
0198         return $this;
0199     }
0200 
0201     /**
0202      * @return string|null
0203      */
0204     public function getLength()
0205     {
0206         return $this->_length;
0207     }
0208 
0209     /**
0210      * @param string|null $value
0211      * @return Zend_Gdata_App_Entry Provides a fluent interface
0212      */
0213     public function setLength($value)
0214     {
0215         $this->_length = $value;
0216         return $this;
0217     }
0218 
0219 }