*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Gdata / Gbase / Extension / BaseAttribute.php
blob185205616da3546be64ca77bcab9b8925fc7dd8b
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
16 * @package Zend_Gdata
17 * @subpackage Gbase
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 $
23 /**
24 * @see Zend_Gdata_App_Extension_Element
26 require_once 'Zend/Gdata/App/Extension/Element.php';
28 /**
29 * Concrete class for working with ItemType elements.
31 * @category Zend
32 * @package Zend_Gdata
33 * @subpackage Gbase
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
40 /**
41 * Namespace for Google Base elements
43 * var @string
45 protected $_rootNamespace = 'g';
47 /**
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);
57 if ($type !== null) {
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),
65 $text);
68 /**
69 * Get the name of the attribute
71 * @return attribute name The requested object.
73 public function getName() {
74 return $this->_rootElement;
77 /**
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'];
87 /**
88 * Set the 'name' of the Base attribute object:
89 * &lt;g:[$name] type='[$type]'&gt;[$value]&lt;/g:[$name]&gt;
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;
97 return $this;
101 * Set the 'type' of the Base attribute object:
102 * &lt;g:[$name] type='[$type]'&gt;[$value]&lt;/g:[$name]&gt;
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);
112 return $this;