*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Gdata / Media / Extension / MediaCredit.php
blob1c5cc0096f6e43f72e13b007fe0ced5a40794d09
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
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.
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Media
19 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: MediaCredit.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 /**
25 * @see Zend_Gdata_App_Extension
27 require_once 'Zend/Gdata/App/Extension.php';
29 /**
30 * Represents the media:credit element
32 * @category Zend
33 * @package Zend_Gdata
34 * @subpackage Media
35 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_Media_Extension_MediaCredit extends Zend_Gdata_Extension
41 protected $_rootElement = 'credit';
42 protected $_rootNamespace = 'media';
44 /**
45 * @var string
47 protected $_role = null;
49 /**
50 * @var string
52 protected $_scheme = null;
54 /**
55 * Creates an individual MediaCredit object.
57 * @param string $text
58 * @param string $role
59 * @param string $scheme
61 public function __construct($text = null, $role = null, $scheme = null)
63 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
64 parent::__construct();
65 $this->_text = $text;
66 $this->_role = $role;
67 $this->_scheme = $scheme;
70 /**
71 * Retrieves a DOMElement which corresponds to this element and all
72 * child properties. This is used to build an entry back into a DOM
73 * and eventually XML text for sending to the server upon updates, or
74 * for application storage/persistence.
76 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
77 * @return DOMElement The DOMElement representing this element and all
78 * child properties.
80 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
82 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
83 if ($this->_role !== null) {
84 $element->setAttribute('role', $this->_role);
86 if ($this->_scheme !== null) {
87 $element->setAttribute('scheme', $this->_scheme);
89 return $element;
92 /**
93 * Given a DOMNode representing an attribute, tries to map the data into
94 * instance members. If no mapping is defined, the name and value are
95 * stored in an array.
97 * @param DOMNode $attribute The DOMNode attribute needed to be handled
99 protected function takeAttributeFromDOM($attribute)
101 switch ($attribute->localName) {
102 case 'role':
103 $this->_role = $attribute->nodeValue;
104 break;
105 case 'scheme':
106 $this->_scheme = $attribute->nodeValue;
107 break;
108 default:
109 parent::takeAttributeFromDOM($attribute);
114 * @return string
116 public function getRole()
118 return $this->_role;
122 * @param string $value
123 * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent interface
125 public function setRole($value)
127 $this->_role = $value;
128 return $this;
132 * @return string
134 public function getScheme()
136 return $this->_scheme;
140 * @param string $value
141 * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent interface
143 public function setScheme($value)
145 $this->_scheme = $value;
146 return $this;