PortableInfobox/services/Parser/Nodes/NodeInfobox.php

51 lines
922 B
PHP
Raw Normal View History

<?php
namespace Wikia\PortableInfobox\Parser\Nodes;
class NodeInfobox extends Node {
protected $params;
public function getData() {
if ( !isset( $this->data ) ) {
2015-06-11 09:34:28 +00:00
$this->data = [ 'value' => $this->getDataForChildren() ];
}
return $this->data;
}
2015-06-11 09:34:28 +00:00
public function getRenderData() {
2015-06-11 12:51:54 +00:00
return $this->getRenderDataForChildren();
2015-06-11 09:34:28 +00:00
}
public function isEmpty() {
2015-06-11 09:34:28 +00:00
/** @var Node $child */
foreach ( $this->getChildNodes() as $child ) {
if ( !$child->isEmpty() ) {
return false;
}
}
return true;
}
public function getParams() {
if ( !isset( $this->params ) ) {
$result = [ ];
foreach ( $this->xmlNode->attributes() as $k => $v ) {
2017-01-02 09:58:02 +00:00
$result[$k] = (string)$v;
}
$this->params = $result;
}
return $this->params;
}
public function getSources() {
return $this->getSourcesForChildren();
}
2017-01-02 09:58:02 +00:00
public function getMetadata() {
return $this->getMetadataForChildren();
}
}