Exemplo n.º 1
0
 /**
  * Receives a builder element and adds it to the project's integration
  * builder. It optionally receives an ID of the element to add to as a
  * child. It defaults to adding to the first target found in the project,
  * if no element ID is specified. This method also checks if the element
  * is a special task, and registers it accordingly in the project.
  *
  * @param Build_BuilderElement $element
  * @param string $id
  */
 public function addToIntegrationBuilder(Build_BuilderElement $element, $id = null)
 {
     //
     // TODO: implement "add to id" logic later
     //
     if (empty($id)) {
         if ($element instanceof Build_BuilderElement_Type_Property) {
             //
             // We need to pull the whole $properties attribute because of the
             // auto-save. Using the addProperty is a mangled no-man's land
             // that basically never triggers the auto-save (arrays and references
             // are f****d up...)
             //
             $properties = $this->getIntegrationBuilder()->getProperties();
             $properties[$element->getName()] = $element;
             // Existing property gets overwritten
             $this->getIntegrationBuilder()->setProperties($properties);
         } else {
             $targets = $this->getIntegrationBuilder()->getTargets();
             $target = $targets[0];
             $target->addTask($element);
         }
     }
     //
     // If it's a special task, register it with the project
     //
     if ($element->isSpecialTask()) {
         $this->registerSpecialTask($element->getSpecialTask());
     }
 }