2015-06-10 15:19:40 +00:00
|
|
|
<?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() ];
|
2015-06-10 15:19:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2015-06-10 15:19:40 +00:00
|
|
|
public function isEmpty() {
|
2015-06-11 09:34:28 +00:00
|
|
|
/** @var Node $child */
|
|
|
|
foreach ( $this->getChildNodes() as $child ) {
|
|
|
|
if ( !$child->isEmpty() ) {
|
2015-06-10 15:19:40 +00:00
|
|
|
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() {
|
2015-06-11 09:48:32 +00:00
|
|
|
return $this->getSourceForChildren();
|
2015-06-10 15:19:40 +00:00
|
|
|
}
|
2016-03-31 09:58:34 +00:00
|
|
|
|
|
|
|
public function getSourceLabel() {
|
|
|
|
return $this->getSourceLabelForChildren();
|
|
|
|
}
|
2015-06-10 15:19:40 +00:00
|
|
|
}
|