/** Configure the wrapped element and all children. */ function maybeConfigure(Project $project) { $id = null; // DataType configured in ProjectConfigurator // if ( is_a($this->wrappedObject, "DataType") ) // return; if ($this->attributes || $this->characters) { ProjectConfigurator::configure($this->wrappedObject, $this->attributes, $project); if (isset($this->attributes["id"])) { $id = $this->attributes["id"]; } $this->attributes = null; if ($this->characters) { ProjectConfigurator::addText($project, $this->wrappedObject, (string) $this->characters); $this->characters = ""; } if ($id !== null) { $project->addReference($id, $this->wrappedObject); } } if (is_array($this->children) && !empty($this->children)) { // Configure all child of this object ... foreach ($this->children as $child) { $child->maybeConfigure($project); ProjectConfigurator::storeChild($project, $this->wrappedObject, $child->wrappedObject, strtolower($child->getElementTag())); } } }