CommunityID/libs/Zend/Gdata/Gbase/Extension/BaseAttribute.php

116 lines
3.6 KiB
PHP
Raw Normal View History

2019-07-17 20:08:50 +00:00
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gbase
2019-07-17 20:19:00 +00:00
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
2019-07-17 20:08:50 +00:00
* @license http://framework.zend.com/license/new-bsd New BSD License
2019-07-17 20:19:00 +00:00
* @version $Id: BaseAttribute.php 16971 2009-07-22 18:05:45Z mikaelkael $
2019-07-17 20:08:50 +00:00
*/
/**
* @see Zend_Gdata_App_Extension_Element
*/
require_once 'Zend/Gdata/App/Extension/Element.php';
/**
* Concrete class for working with ItemType elements.
*
* @category Zend
* @package Zend_Gdata
2019-07-17 20:16:19 +00:00
* @subpackage Gbase
2019-07-17 20:19:00 +00:00
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
2019-07-17 20:08:50 +00:00
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gbase_Extension_BaseAttribute extends Zend_Gdata_App_Extension_Element
{
/**
* Namespace for Google Base elements
*
* var @string
*/
protected $_rootNamespace = 'g';
2019-07-17 20:16:19 +00:00
2019-07-17 20:08:50 +00:00
/**
* Create a new instance.
2019-07-17 20:16:19 +00:00
*
2019-07-17 20:08:50 +00:00
* @param string $name (optional) The name of the Base attribute
* @param string $text (optional) The text value of the Base attribute
* @param string $text (optional) The type of the Base attribute
*/
public function __construct($name = null, $text = null, $type = null)
{
2019-07-17 20:16:19 +00:00
$this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces);
2019-07-17 20:08:50 +00:00
if ($type !== null) {
$attr = array('name' => 'type', 'value' => $type);
$typeAttr = array('type' => $attr);
$this->setExtensionAttributes($typeAttr);
}
2019-07-17 20:16:19 +00:00
parent::__construct($name,
$this->_rootNamespace,
$this->lookupNamespace($this->_rootNamespace),
2019-07-17 20:08:50 +00:00
$text);
}
/**
* Get the name of the attribute
*
* @return attribute name The requested object.
*/
public function getName() {
return $this->_rootElement;
}
/**
* Get the type of the attribute
*
* @return attribute type The requested object.
*/
public function getType() {
$typeAttr = $this->getExtensionAttributes();
return $typeAttr['type']['value'];
}
/**
* Set the 'name' of the Base attribute object:
2019-07-17 20:16:19 +00:00
* &lt;g:[$name] type='[$type]'&gt;[$value]&lt;/g:[$name]&gt;
2019-07-17 20:08:50 +00:00
*
* @param Zend_Gdata_App_Extension_Element $attribute The attribute object
* @param string $name The name of the Base attribute
* @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface
*/
public function setName($name) {
$this->_rootElement = $name;
return $this;
}
/**
* Set the 'type' of the Base attribute object:
2019-07-17 20:16:19 +00:00
* &lt;g:[$name] type='[$type]'&gt;[$value]&lt;/g:[$name]&gt;
2019-07-17 20:08:50 +00:00
*
* @param Zend_Gdata_App_Extension_Element $attribute The attribute object
* @param string $type The type of the Base attribute
* @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface
*/
public function setType($type) {
$attr = array('name' => 'type', 'value' => $type);
$typeAttr = array('type' => $attr);
$this->setExtensionAttributes($typeAttr);
return $this;
}
}