BpNode: remove code related to legacy config

This commit is contained in:
Thomas Gelf 2017-01-11 13:40:42 +01:00
parent 75dc5e0ef6
commit 149696fb50

View file

@ -428,6 +428,22 @@ class BpNode extends Node
return $this->children;
}
/**
* return BpNode[]
*/
public function getChildBpNodes()
{
$children = array();
foreach ($this->getChildren() as $name => $child) {
if ($child instanceof BpNode) {
$children[$name] = $child;
}
}
return $children;
}
protected function assertNumericOperator()
{
if (! is_numeric($this->operator)) {
@ -435,62 +451,6 @@ class BpNode extends Node
}
}
public function toLegacyConfigString(& $rendered = array())
{
$cfg = '';
if (array_key_exists($this->name, $rendered)) {
return $cfg;
}
$rendered[$this->name] = true;
$children = array();
foreach ($this->getChildren() as $name => $child) {
$children[] = (string) $child;
if (array_key_exists($name, $rendered)) {
continue;
}
if ($child instanceof BpNode) {
$cfg .= $child->toLegacyConfigString($rendered) . "\n";
}
}
$eq = '=';
$op = $this->operator;
if (is_numeric($op)) {
$eq = '= ' . $op . ' of:';
$op = '+';
}
$strChildren = implode(' ' . $op . ' ', $children);
if ((count($children) < 2) && $op !== '&') {
$strChildren = $op . ' ' . $strChildren;
}
$cfg .= sprintf(
"%s %s %s\n",
$this->name,
$eq,
$strChildren
);
if ($this->hasAlias() || $this->getDisplay() > 0) {
$prio = $this->getDisplay();
$cfg .= sprintf(
"display %s;%s;%s\n",
$prio,
$this->name,
$this->getAlias()
);
}
if ($this->hasInfoUrl()) {
$cfg .= sprintf(
"info_url;%s;%s\n",
$this->name,
$this->getInfoUrl()
);
}
return $cfg;
}
public function operatorHtml()
{
switch ($this->operator) {