classes/phing/tasks/system/PhingTask.php
private function copyReference($oldKey, $newKey)
    {
        $orig = $this->project->getReference($oldKey);
        if ($orig === null) {
            $this->log(
                "No object referenced by " . $oldKey . ". Can't copy to "
                . $newKey,
                Project::MSG_WARN
            );

            return;
        }

        $copy = clone $orig;

        if ($copy instanceof ProjectComponent) {
            $copy->setProject($this->newProject);
        } elseif (in_array('setProject', get_class_methods(get_class($copy)))) {
            $copy->setProject($this->newProject);
        } elseif ($copy instanceof Project) {
            // don't copy the old "Project" itself
        } else {
            $msg = "Error setting new project instance for "
                . "reference with id " . $oldKey;
            throw new BuildException($msg);
        }

        $this->newProject->addReference($newKey, $copy);
    }
private function copyReference($oldKey, $newKey)
    {
        $orig = $this->project->getReference($oldKey);
        if ($orig === null) {
            $this->log(
                "No object referenced by " . $oldKey . ". Can't copy to "
                . $newKey,
                Project::MSG_WARN
            );

            return;
        }

        $copy = clone $orig;

        if ($copy instanceof ProjectComponent) {
            $copy->setProject($this->newProject);
        } elseif (in_array('setProject', get_class_methods(get_class($copy)))) {
            $copy->setProject($this->newProject);
        } elseif ($copy instanceof Project) {
            // don't copy the old "Project" itself
        } else {
            $msg = "Error setting new project instance for "
                . "reference with id " . $oldKey;
            throw new BuildException($msg);
        }

        $this->newProject->addReference($newKey, $copy);
    }
private function copyReference ( $ oldKey , $ newKey ) { $ orig = $ this -> project -> getReference ( $ oldKey ) ; if ( $ orig === null ) { $ this -> log ( "No object referenced by " . $ oldKey . ". Can't copy to " . $ newKey , Project :: MSG_WARN ) ; return ; } $ copy = clone $ orig ; if ( $ copy instanceof ProjectComponent ) { $ copy -> setProject ( $ this -> newProject ) ; } elseif ( in_array ( 'setProject' , get_class_methods ( get_class ( $ copy ) ) ) ) { $ copy -> setProject ( $ this -> newProject ) ; } elseif ( $ copy instanceof Project ) { // don't copy the old "Project" itself } else { $ msg = "Error setting new project instance for " . "reference with id " . $ oldKey ; throw new BuildException ( $ msg ) ; } $ this -> newProject -> addReference ( $ newKey , $ copy ) ; }
Try to clone and reconfigure the object referenced by oldkey in
the parent project and add it to the new project with the key
newkey.

<p>If we cannot clone it, copy the referenced object itself and
keep our fingers crossed.</p>

@param  string $oldKey
@param  string $newKey
@throws BuildException
@return void
Try to clone and reconfigure the object referenced by oldkey in the parent project and add it to the new project with the key newkey .