mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-05-28 04:34:08 -04:00
BpNode: add a new helper method
This commit is contained in:
parent
6bb1c07461
commit
61fd8caa93
1 changed files with 18 additions and 1 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace Icinga\Module\Businessprocess;
|
||||
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\NotFoundError;
|
||||
use Icinga\Module\Businessprocess\Exception\NestingError;
|
||||
|
||||
class BpNode extends Node
|
||||
|
|
@ -121,7 +122,7 @@ class BpNode extends Node
|
|||
{
|
||||
$problems = array();
|
||||
|
||||
foreach ($this->children as $child) {
|
||||
foreach ($this->getChildren() as $child) {
|
||||
if ($child->isProblem()
|
||||
|| ($child instanceof BpNode && $child->hasProblems())
|
||||
) {
|
||||
|
|
@ -444,6 +445,22 @@ class BpNode extends Node
|
|||
return $children;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $childName
|
||||
* @return Node
|
||||
* @throws NotFoundError
|
||||
*/
|
||||
public function getChildByName($childName)
|
||||
{
|
||||
foreach ($this->getChildren() as $name => $child) {
|
||||
if ($name === $childName) {
|
||||
return $child;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotFoundError('Trying to get missing child %s', $childName);
|
||||
}
|
||||
|
||||
protected function assertNumericOperator()
|
||||
{
|
||||
if (! is_numeric($this->operator)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue