public static function parse(Ezer_StepContainer $stepContainer, DOMElement $element)
 {
     $stepContainer->setName($element->getAttribute('name'));
     for ($i = 0; $i < $element->childNodes->length; $i++) {
         $childElement = $element->childNodes->item($i);
         if ($childElement->parentNode !== $element) {
             continue;
         }
         if ($childElement instanceof DOMComment || $childElement instanceof DOMText) {
             continue;
         }
         switch ($childElement->nodeName) {
             case 'import':
                 // ignore, relevant for process only
                 break;
             case 'variables':
                 // ignore, relevant for scope only
                 break;
             case 'condition':
             case 'else':
             case 'elseif':
                 // ignore, relevant for if only
                 break;
             case 'flow':
                 $stepContainer->addStep(new Ezer_XmlFlow($childElement));
                 break;
             case 'sequence':
                 $stepContainer->addStep(new Ezer_XmlSequence($childElement));
                 break;
             case 'activity':
                 $stepContainer->addStep(new Ezer_XmlActivityStep($childElement));
                 break;
             case 'assign':
                 $stepContainer->addStep(new Ezer_XmlAssignStep($childElement));
                 break;
             case 'if':
                 $stepContainer->addStep(new Ezer_XmlIf($childElement));
                 break;
             case 'foreach':
                 // TODO - implement foreach
             // TODO - implement foreach
             case 'repeatUntil':
                 // TODO - implement repeatUntil
             // TODO - implement repeatUntil
             case 'while':
                 // TODO - implement while
             // TODO - implement while
             case 'switch':
                 // TODO - implement switch
             // TODO - implement switch
             case 'empty':
                 // TODO - implement empty
             // TODO - implement empty
             case 'wait':
                 // TODO - implement wait
             // TODO - implement wait
             case 'terminate':
                 // TODO - implement terminate
             // TODO - implement terminate
             case 'throw':
                 // TODO - implement throw
             // TODO - implement throw
             case 'rethrow':
                 // TODO - implement rethrow
             // TODO - implement rethrow
             default:
                 throw new Ezer_XmlPersistanceElementNotMappedException($childElement->nodeName);
         }
     }
 }
 public static function load(Ezer_StepContainer $stepContainer, Ezer_IntStepContainer $container)
 {
     $stepContainer->setName($container->getName());
     $steps = $container->getSteps();
     foreach ($steps as $step) {
         switch ($step->getType()) {
             case Ezer_IntStep::STEP_TYPE_SCOPE:
                 $stepContainer->addStep(new Ezer_DbScope($step));
                 break;
             case Ezer_IntStep::STEP_TYPE_FLOW:
                 $stepContainer->addStep(new Ezer_DbFlow($step));
                 break;
             case Ezer_IntStep::STEP_TYPE_SEQUENCE:
                 $stepContainer->addStep(new Ezer_DbSequence($step));
                 break;
             case Ezer_IntStep::STEP_TYPE_ACTIVITY:
                 $stepContainer->addStep(new Ezer_DbActivityStep($step));
                 break;
             case Ezer_IntStep::STEP_TYPE_ASSIGN:
                 $stepContainer->addStep(new Ezer_DbAssignStep($step));
                 break;
             case Ezer_IntStep::STEP_TYPE_IF:
                 if ($stepContainer instanceof Ezer_If) {
                     $stepContainer->addElseIf(new Ezer_DbIf($step));
                 } else {
                     $stepContainer->addStep(new Ezer_DbIf($step));
                 }
                 break;
             case Ezer_IntStep::STEP_TYPE_ELSE:
                 if ($stepContainer instanceof Ezer_If) {
                     $stepContainer->setElse(new Ezer_DbElse($step));
                 }
                 break;
             case Ezer_IntStep::STEP_TYPE_FOREACH:
                 $stepContainer->addStep(new Ezer_DbForeach($step));
                 break;
                 //				case Ezer_IntStep::STEP_TYPE_REPEAT_UNTIL:
                 //					$stepContainer->addStep(new Ezer_DbRepeatUntil($step));
                 //					break;
                 //
                 //				case Ezer_IntStep::STEP_TYPE_WHILE:
                 //					$stepContainer->addStep(new Ezer_DbWhile($step));
                 //					break;
                 //
                 //				case Ezer_IntStep::STEP_TYPE_SWITCH:
                 //					$stepContainer->addStep(new Ezer_DbSwitch($step));
                 //					break;
                 //
                 //				case Ezer_IntStep::STEP_TYPE_EMPTY:
                 //					$stepContainer->addStep(new Ezer_DbEmpty($step));
                 //					break;
                 //
                 //				case Ezer_IntStep::STEP_TYPE_WAIT:
                 //					$stepContainer->addStep(new Ezer_DbWait($step));
                 //					break;
                 //
                 //				case Ezer_IntStep::STEP_TYPE_TERMINATE:
                 //					$stepContainer->addStep(new Ezer_DbTerminate($step));
                 //					break;
                 //
                 //				case Ezer_IntStep::STEP_TYPE_THROW:
                 //					$stepContainer->addStep(new Ezer_DbThrow($step));
                 //					break;
                 //
                 //				case Ezer_IntStep::STEP_TYPE_RETHROW:
                 //					$stepContainer->addStep(new Ezer_DbRethrow($step));
                 //					break;
         }
     }
 }