move atom category to its own file, too
This commit is contained in:
@@ -362,48 +362,3 @@ class Activity
|
||||
}
|
||||
}
|
||||
|
||||
class AtomCategory
|
||||
{
|
||||
public $term;
|
||||
public $scheme;
|
||||
public $label;
|
||||
|
||||
function __construct($element=null)
|
||||
{
|
||||
if ($element && $element->attributes) {
|
||||
$this->term = $this->extract($element, 'term');
|
||||
$this->scheme = $this->extract($element, 'scheme');
|
||||
$this->label = $this->extract($element, 'label');
|
||||
}
|
||||
}
|
||||
|
||||
protected function extract($element, $attrib)
|
||||
{
|
||||
$node = $element->attributes->getNamedItemNS(Activity::ATOM, $attrib);
|
||||
if ($node) {
|
||||
return trim($node->textContent);
|
||||
}
|
||||
$node = $element->attributes->getNamedItem($attrib);
|
||||
if ($node) {
|
||||
return trim($node->textContent);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function asString()
|
||||
{
|
||||
$attribs = array();
|
||||
if ($this->term !== null) {
|
||||
$attribs['term'] = $this->term;
|
||||
}
|
||||
if ($this->scheme !== null) {
|
||||
$attribs['scheme'] = $this->scheme;
|
||||
}
|
||||
if ($this->label !== null) {
|
||||
$attribs['label'] = $this->label;
|
||||
}
|
||||
$xs = new XMLStringer();
|
||||
$xs->element('category', $attribs);
|
||||
return $xs->asString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user