/** * */ public function init() { parent::init(); if ($this->strictMode === 'true') { $this->strictMode = true; } else { $this->strictMode = false; } }
/** * @param SimpleXMLElement $xml * @param StateMachine $sm * @param StateMachineState $state * @return static */ public static function fromXml(SimpleXMLElement $xml, StateMachine $sm, StateMachineState $state) { $rVal = new static(); $rVal->sm = $sm; $rVal->state = $state; $rVal->target = (string) $xml->attributes()->target; $rVal->label = (string) $xml->attributes()->label; $rVal->data = []; foreach ($xml->attributes() as $k => $v) { if (!in_array($k, ['target', 'label'])) { $rVal->data[$k] = (string) $v; } } if (!empty($xml->role)) { foreach ($xml->role as $roleXml) { $rVal->roles[] = (string) $roleXml; } } $conditions = !empty($xml->conditions) ? $xml->conditions[0]->condition : []; foreach ($conditions as $condition) { $rVal->conditions[] = Condition::fromXml($condition, $sm); } return $rVal; }