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.
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: BaseAttribute.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 * @see Zend_Gdata_App_Extension_Element
26 require_once 'Zend/Gdata/App/Extension/Element.php';
29 * Concrete class for working with ItemType elements.
34 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
35 * @license http://framework.zend.com/license/new-bsd New BSD License
37 class Zend_Gdata_Gbase_Extension_BaseAttribute
extends Zend_Gdata_App_Extension_Element
41 * Namespace for Google Base elements
45 protected $_rootNamespace = 'g';
48 * Create a new instance.
50 * @param string $name (optional) The name of the Base attribute
51 * @param string $text (optional) The text value of the Base attribute
52 * @param string $text (optional) The type of the Base attribute
54 public function __construct($name = null, $text = null, $type = null)
56 $this->registerAllNamespaces(Zend_Gdata_Gbase
::$namespaces);
58 $attr = array('name' => 'type', 'value' => $type);
59 $typeAttr = array('type' => $attr);
60 $this->setExtensionAttributes($typeAttr);
62 parent
::__construct($name,
63 $this->_rootNamespace
,
64 $this->lookupNamespace($this->_rootNamespace
),
69 * Get the name of the attribute
71 * @return attribute name The requested object.
73 public function getName() {
74 return $this->_rootElement
;
78 * Get the type of the attribute
80 * @return attribute type The requested object.
82 public function getType() {
83 $typeAttr = $this->getExtensionAttributes();
84 return $typeAttr['type']['value'];
88 * Set the 'name' of the Base attribute object:
89 * <g:[$name] type='[$type]'>[$value]</g:[$name]>
91 * @param Zend_Gdata_App_Extension_Element $attribute The attribute object
92 * @param string $name The name of the Base attribute
93 * @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface
95 public function setName($name) {
96 $this->_rootElement
= $name;
101 * Set the 'type' of the Base attribute object:
102 * <g:[$name] type='[$type]'>[$value]</g:[$name]>
104 * @param Zend_Gdata_App_Extension_Element $attribute The attribute object
105 * @param string $type The type of the Base attribute
106 * @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface
108 public function setType($type) {
109 $attr = array('name' => 'type', 'value' => $type);
110 $typeAttr = array('type' => $attr);
111 $this->setExtensionAttributes($typeAttr);