19declare(strict_types=1);
32 $this->xml_root =
new SimpleXMLElement(
'<Conditions></Conditions>');
38 $cond_xml = $this->xml_root->addChild(
'Condition');
39 $cond_xml->addAttribute(
'object_id', (
string)
$info->getObjectId());
40 $cond_xml->addAttribute(
'reference_id', (
string)
$info->getReferenceId());
41 $cond_xml->addAttribute(
'object_type',
$info->getObjectType());
42 $cond_xml->addAttribute(
'hide_object_enabled', (
string) ((
int)
$info->getConditionSet()->getHiddenStatus()));
43 $cond_xml->addAttribute(
'all_obligatory_enabled', (
string) ((
int)
$info->getConditionSet()->getAllObligatory()));
44 $cond_xml->addAttribute(
'number_of_required_materials', (
string)
$info->getConditionSet()->getNumObligatory());
45 $p_conds_xml = $cond_xml->addChild(
'Preconditions');
46 foreach (
$info->getConditionSet()->getConditions() as $precondition) {
47 $p_cond_xml = $p_conds_xml->addChild(
'Precondition');
48 $p_cond_xml->addAttribute(
'id', (
string) $precondition->getId());
49 $p_cond_xml->addAttribute(
'is_obligatory', (
string) ((
int) $precondition->getObligatory()));
50 $p_cond_xml->addAttribute(
'operator', $precondition->getOperator());
51 $p_cond_xml->addAttribute(
'value', $precondition->getValue() ??
'');
52 $p_cond_trigger_xml = $p_cond_xml->addChild(
'Trigger');
53 $p_cond_trigger_xml->addAttribute(
'ref_id', (
string) $precondition->getTrigger()->getRefId());
54 $p_cond_trigger_xml->addAttribute(
'obj_id', (
string) $precondition->getTrigger()->getObjId());
55 $p_cond_trigger_xml->addAttribute(
'type', $precondition->getTrigger()->getType());
62 foreach ($infos as
$info) {
69 return trim(str_replace(
'<?xml version="1.0"?>',
'', $this->xml_root->asXML()));
SimpleXMLElement $xml_root
writeAll(InfoCollection $infos)
Condition set Note: This object currently focuses on repository objects as targets.