/** * Visit single element in regular expression * * The return type of this method varies deping on the concrete visitor * implementation * * @param slRegularExpressionElement $element * @return mixed */ protected function visitElement(slRegularExpressionElement $element) { $schemaElement = $this->schemaVisitor->getType($element->getContent()->type); $node = $this->document->createElementNS('http://www.w3.org/2001/XMLSchema', 'element'); $node->setAttribute('name', $element->getContent()->name); if ($schemaElement->type->regularExpression instanceof slRegularExpressionEmpty && !count($schemaElement->type->attributes)) { if ($schemaElement->type->simpleTypeInferencer->inferenceType() !== 'empty') { $node->setAttribute('type', $this->schemaVisitor->getXmlSchemaSimpleType($schemaElement->type->simpleTypeInferencer)); } } else { $node->setAttribute('type', $schemaElement->type->name); } return $node; }
/** * Visit single element in regular expression * * The return type of this method varies deping on the concrete visitor * implementation * * @param slRegularExpressionElement $element * @return mixed */ protected function visitElement(slRegularExpressionElement $element) { return (string) $element->getContent()->name; }
public function testElementSetContent() { $regexp = new slRegularExpressionElement('a'); $regexp->setContent('b'); $this->assertSame('b', $regexp->getContent()); }