/** * Visit sequence sub expression * * The return type of this method varies deping on the concrete visitor * implementation * * @param slRegularExpressionSequence $regularExpression * @return mixed */ protected function visitSequence(slRegularExpressionSequence $regularExpression) { return '( ' . implode(', ', array_map(array($this, 'visit'), $regularExpression->getChildren())) . ' )'; }
/** * Visit sequence sub expression * * The return type of this method varies deping on the concrete visitor * implementation * * @param slRegularExpressionSequence $regularExpression * @return mixed */ protected function visitSequence(slRegularExpressionSequence $regularExpression) { $sequence = $this->document->createElementNS('http://www.w3.org/2001/XMLSchema', 'sequence'); foreach ($regularExpression->getChildren() as $child) { $sequence->appendChild($this->visit($child)); } return $sequence; }
public function testMultipleSetChildren() { $regexp = new slRegularExpressionSequence(new slRegularExpressionElement('a')); $regexp->setChildren(array($c1 = new slRegularExpressionElement('b'), $c2 = new slRegularExpressionElement('c'))); $this->assertSame(array($c1, $c2), $regexp->getChildren()); }