1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Zend Framework
|
---|
5 | *
|
---|
6 | * LICENSE
|
---|
7 | *
|
---|
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.
|
---|
15 | *
|
---|
16 | * @category Zend
|
---|
17 | * @package Zend_Gdata
|
---|
18 | * @subpackage Gdata
|
---|
19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
21 | */
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @see Zend_Gdata_Extension
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/Extension.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Data model for gd:extendedProperty element, used by some Gdata
|
---|
30 | * services to implement arbitrary name/value pair storage
|
---|
31 | *
|
---|
32 | * @category Zend
|
---|
33 | * @package Zend_Gdata
|
---|
34 | * @subpackage Gdata
|
---|
35 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
36 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
37 | */
|
---|
38 | class Zend_Gdata_Extension_ExtendedProperty extends Zend_Gdata_Extension
|
---|
39 | {
|
---|
40 |
|
---|
41 | protected $_rootElement = 'extendedProperty';
|
---|
42 | protected $_name = null;
|
---|
43 | protected $_value = null;
|
---|
44 |
|
---|
45 | public function __construct($name = null, $value = null)
|
---|
46 | {
|
---|
47 | parent::__construct();
|
---|
48 | $this->_name = $name;
|
---|
49 | $this->_value = $value;
|
---|
50 | }
|
---|
51 |
|
---|
52 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
53 | {
|
---|
54 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
55 | if ($this->_name !== null) {
|
---|
56 | $element->setAttribute('name', $this->_name);
|
---|
57 | }
|
---|
58 | if ($this->_value !== null) {
|
---|
59 | $element->setAttribute('value', $this->_value);
|
---|
60 | }
|
---|
61 | return $element;
|
---|
62 | }
|
---|
63 |
|
---|
64 | protected function takeAttributeFromDOM($attribute)
|
---|
65 | {
|
---|
66 | switch ($attribute->localName) {
|
---|
67 | case 'name':
|
---|
68 | $this->_name = $attribute->nodeValue;
|
---|
69 | break;
|
---|
70 | case 'value':
|
---|
71 | $this->_value = $attribute->nodeValue;
|
---|
72 | break;
|
---|
73 | default:
|
---|
74 | parent::takeAttributeFromDOM($attribute);
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | public function __toString()
|
---|
79 | {
|
---|
80 | return $this->getName() . '=' . $this->getValue();
|
---|
81 | }
|
---|
82 |
|
---|
83 | public function getName()
|
---|
84 | {
|
---|
85 | return $this->_name;
|
---|
86 | }
|
---|
87 |
|
---|
88 | public function setName($value)
|
---|
89 | {
|
---|
90 | $this->_name = $value;
|
---|
91 | return $this;
|
---|
92 | }
|
---|
93 |
|
---|
94 | public function getValue()
|
---|
95 | {
|
---|
96 | return $this->_value;
|
---|
97 | }
|
---|
98 |
|
---|
99 | public function setValue($value)
|
---|
100 | {
|
---|
101 | $this->_value = $value;
|
---|
102 | return $this;
|
---|
103 | }
|
---|
104 |
|
---|
105 | }
|
---|