PortableInfobox/services/Parser/Nodes/NodeInfobox.php

47 lines
843 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 ) {
$result[ $k ] = (string)$v;
}
$this->params = $result;
}
return $this->params;
}
public function getSource() {
return $this->getSourceForChildren();
}
}