2015-06-10 15:19:40 +00:00
|
|
|
<?php
|
2018-08-09 09:49:10 +00:00
|
|
|
namespace PortableInfobox\Parser\Nodes;
|
2015-06-10 15:19:40 +00:00
|
|
|
|
|
|
|
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 ) ) {
|
2018-08-16 09:25:53 +00:00
|
|
|
$result = [];
|
2015-06-10 15:19:40 +00:00
|
|
|
foreach ( $this->xmlNode->attributes() as $k => $v ) {
|
2017-01-02 09:58:02 +00:00
|
|
|
$result[$k] = (string)$v;
|
2015-06-10 15:19:40 +00:00
|
|
|
}
|
|
|
|
$this->params = $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->params;
|
|
|
|
}
|
|
|
|
|
2016-12-09 13:01:49 +00:00
|
|
|
public function getSources() {
|
|
|
|
return $this->getSourcesForChildren();
|
2015-06-10 15:19:40 +00:00
|
|
|
}
|
2017-01-02 09:58:02 +00:00
|
|
|
|
|
|
|
public function getMetadata() {
|
|
|
|
return $this->getMetadataForChildren();
|
|
|
|
}
|
2015-06-10 15:19:40 +00:00
|
|
|
}
|