public function __construct($name, $id = NULL) { $this->inputParameters = []; $this->meta = new Meta(); $this->meta->setName($name); //use the name as the id $this->setID($id === NULL ? $name : $id); }
public function parseMeta($xml) { if ($xml->moveToAttribute('name') && $xml->value == "commonAttributes") { $xml->moveToElement(); while ($xml->read()) { if ($xml->nodeType == XMLReader::ELEMENT) { switch ($xml->localName) { case 'MetaText': case 'MetaString': $meta = new Meta(); $xml->moveToAttribute('name'); $meta->setName($xml->value); $xml->moveToElement(); $meta->addValue($xml->readOuterXML()); break; } $metas[] = $meta; } else { if ($xml->nodeType == XMLReader::END_ELEMENT && $xml->localName == 'Meta') { break; } } } return $metas; } else { if ($xml->moveToAttribute('name') && $xml->value == 'fieldAttributes') { $xml->moveToElement(); $meta = new Meta(); while ($xml->read()) { if ($xml->nodeType == XMLReader::ELEMENT) { if ($xml->moveToAttribute('name') && $xml->value == 'name') { $xml->moveToElement(); $meta->setName($xml->readString()); } else { if ($xml->moveToAttribute('name') && $xml->value == 'value') { $xml->moveToElement(); $meta->addValue($xml->readOuterXML()); } } } else { if ($xml->nodeType == XMLReader::END_ELEMENT && $xml->localName == 'Meta') { break; } } } return $meta; } else { $meta = new Meta(); $xml->moveToAttribute('name'); $meta->setName($xml->value); $xml->moveToElement(); $meta->addValue($xml->readOuterXML()); while ($xml->nodeType == XMLReader::END_ELEMENT && $xml->localName == 'Meta') { $xml->read(); } return $meta; } } }
public function __construct($name, $required = true) { $this->meta = new Meta(); $this->meta->setName($name); $this->required = $required; }