19declare(strict_types=1);
37 $info_collection = $this->
factory->infoCollection();
38 $xml_root =
new SimpleXMLElement($xml);
39 foreach ($xml_root->children() as $condition) {
40 $condition_objects = [];
41 $preconditions_root = $condition->children()[0];
42 foreach ($preconditions_root->children() as $precondition) {
43 $trigger = $precondition->children()[0];
45 (
int) $trigger->attributes()->ref_id,
46 (
int) $trigger->attributes()->obj_id,
47 (
string) $trigger->attributes()->type
51 (
string) $precondition->attributes()->operator,
52 (
string) $precondition->attributes()->value
54 ->withId((
int) $precondition->attributes()->id)
55 ->withObligatory(((
int) $precondition->attributes()->is_obligatory) === 1);
58 ->withHiddenStatus(((
int) $condition->attributes()->hide_object_enabled) === 1)
59 ->withNumObligatory((
int) $condition->attributes()->number_of_required_materials);
60 if ($condition->attributes()->all_obligatory_enabled) {
61 $condition_set = $condition_set->withAllObligatory();
63 $info_collection = $info_collection->withInfo($this->
factory->info()
64 ->withObjectId((
int) $condition->attributes()->object_id)
65 ->withObjectType((
string) $condition->attributes()->object_type)
66 ->withConditionSet($condition_set)
67 ->withReferenceId((
int) $condition->attributes()->reference_id));
69 return $info_collection;
__construct(protected Factory $factory)
Condition set Note: This object currently focuses on repository objects as targets.
Represents a condition trigger object.