1 | <?php |
---|
2 | /** |
---|
3 | * Zend Framework |
---|
4 | * |
---|
5 | * LICENSE |
---|
6 | * |
---|
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. |
---|
14 | * |
---|
15 | * @category Zend |
---|
16 | * @package Zend_Gdata |
---|
17 | * @subpackage Gbase |
---|
18 | * @copyright Copyright (c) 2005-2012 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 24594 2012-01-05 21:27:01Z matthew $ |
---|
21 | */ |
---|
22 | |
---|
23 | /** |
---|
24 | * @see Zend_Gdata_App_Extension_Element |
---|
25 | */ |
---|
26 | require_once 'Zend/Gdata/App/Extension/Element.php'; |
---|
27 | |
---|
28 | /** |
---|
29 | * Concrete class for working with ItemType elements. |
---|
30 | * |
---|
31 | * @category Zend |
---|
32 | * @package Zend_Gdata |
---|
33 | * @subpackage Gbase |
---|
34 | * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
---|
35 | * @license http://framework.zend.com/license/new-bsd New BSD License |
---|
36 | */ |
---|
37 | class Zend_Gdata_Gbase_Extension_BaseAttribute extends Zend_Gdata_App_Extension_Element |
---|
38 | { |
---|
39 | |
---|
40 | /** |
---|
41 | * Namespace for Google Base elements |
---|
42 | * |
---|
43 | * var @string |
---|
44 | */ |
---|
45 | protected $_rootNamespace = 'g'; |
---|
46 | |
---|
47 | /** |
---|
48 | * Create a new instance. |
---|
49 | * |
---|
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 |
---|
53 | */ |
---|
54 | public function __construct($name = null, $text = null, $type = null) |
---|
55 | { |
---|
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); |
---|
61 | } |
---|
62 | parent::__construct($name, |
---|
63 | $this->_rootNamespace, |
---|
64 | $this->lookupNamespace($this->_rootNamespace), |
---|
65 | $text); |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * Get the name of the attribute |
---|
70 | * |
---|
71 | * @return attribute name The requested object. |
---|
72 | */ |
---|
73 | public function getName() { |
---|
74 | return $this->_rootElement; |
---|
75 | } |
---|
76 | |
---|
77 | /** |
---|
78 | * Get the type of the attribute |
---|
79 | * |
---|
80 | * @return attribute type The requested object. |
---|
81 | */ |
---|
82 | public function getType() { |
---|
83 | $typeAttr = $this->getExtensionAttributes(); |
---|
84 | return $typeAttr['type']['value']; |
---|
85 | } |
---|
86 | |
---|
87 | /** |
---|
88 | * Set the 'name' of the Base attribute object: |
---|
89 | * <g:[$name] type='[$type]'>[$value]</g:[$name]> |
---|
90 | * |
---|
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 |
---|
94 | */ |
---|
95 | public function setName($name) { |
---|
96 | $this->_rootElement = $name; |
---|
97 | return $this; |
---|
98 | } |
---|
99 | |
---|
100 | /** |
---|
101 | * Set the 'type' of the Base attribute object: |
---|
102 | * <g:[$name] type='[$type]'>[$value]</g:[$name]> |
---|
103 | * |
---|
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 |
---|
107 | */ |
---|
108 | public function setType($type) { |
---|
109 | $attr = array('name' => 'type', 'value' => $type); |
---|
110 | $typeAttr = array('type' => $attr); |
---|
111 | $this->setExtensionAttributes($typeAttr); |
---|
112 | return $this; |
---|
113 | } |
---|
114 | |
---|
115 | } |
---|