classes/phing/tasks/system/PhingTask.php
private function addReferences()
    {

        // parent project references
        $projReferences = $this->project->getReferences();

        $newReferences = $this->newProject->getReferences();

        $subprojRefKeys = [];

        if (count($this->references) > 0) {
            for ($i = 0, $count = count($this->references); $i < $count; $i++) {
                $ref = $this->references[$i];
                $refid = $ref->getRefId();

                if ($refid === null) {
                    throw new BuildException(
                        "the refid attribute is required"
                        . " for reference elements"
                    );
                }
                if (!isset($projReferences[$refid])) {
                    $this->log(
                        "Parent project doesn't contain any reference '"
                        . $refid . "'",
                        Project::MSG_WARN
                    );
                    continue;
                }

                $subprojRefKeys[] = $refid;
                //thisReferences.remove(refid);
                $toRefid = $ref->getToRefid();
                if ($toRefid === null) {
                    $toRefid = $refid;
                }
                $this->copyReference($refid, $toRefid);
            }
        }

        // Now add all references that are not defined in the
        // subproject, if inheritRefs is true
        if ($this->inheritRefs) {
            // get the keys that are were not used by the subproject
            $unusedRefKeys = array_diff(array_keys($projReferences), $subprojRefKeys);

            foreach ($unusedRefKeys as $key) {
                if (isset($newReferences[$key])) {
                    continue;
                }
                $this->copyReference($key, $key);
            }
        }
    }
private function addReferences()
    {

        // parent project references
        $projReferences = $this->project->getReferences();

        $newReferences = $this->newProject->getReferences();

        $subprojRefKeys = [];

        if (count($this->references) > 0) {
            for ($i = 0, $count = count($this->references); $i < $count; $i++) {
                $ref = $this->references[$i];
                $refid = $ref->getRefId();

                if ($refid === null) {
                    throw new BuildException(
                        "the refid attribute is required"
                        . " for reference elements"
                    );
                }
                if (!isset($projReferences[$refid])) {
                    $this->log(
                        "Parent project doesn't contain any reference '"
                        . $refid . "'",
                        Project::MSG_WARN
                    );
                    continue;
                }

                $subprojRefKeys[] = $refid;
                //thisReferences.remove(refid);
                $toRefid = $ref->getToRefid();
                if ($toRefid === null) {
                    $toRefid = $refid;
                }
                $this->copyReference($refid, $toRefid);
            }
        }

        // Now add all references that are not defined in the
        // subproject, if inheritRefs is true
        if ($this->inheritRefs) {
            // get the keys that are were not used by the subproject
            $unusedRefKeys = array_diff(array_keys($projReferences), $subprojRefKeys);

            foreach ($unusedRefKeys as $key) {
                if (isset($newReferences[$key])) {
                    continue;
                }
                $this->copyReference($key, $key);
            }
        }
    }
private function addReferences ( ) { // parent project references $ projReferences = $ this -> project -> getReferences ( ) ; $ newReferences = $ this -> newProject -> getReferences ( ) ; $ subprojRefKeys = [ ] ; if ( count ( $ this -> references ) > 0 ) { for ( $ i = 0 , $ count = count ( $ this -> references ) ; $ i < $ count ; $ i ++ ) { $ ref = $ this -> references [ $ i ] ; $ refid = $ ref -> getRefId ( ) ; if ( $ refid === null ) { throw new BuildException ( "the refid attribute is required" . " for reference elements" ) ; } if ( ! isset ( $ projReferences [ $ refid ] ) ) { $ this -> log ( "Parent project doesn't contain any reference '" . $ refid . "'" , Project :: MSG_WARN ) ; continue ; } $ subprojRefKeys [ ] = $ refid ; //thisReferences.remove(refid); $ toRefid = $ ref -> getToRefid ( ) ; if ( $ toRefid === null ) { $ toRefid = $ refid ; } $ this -> copyReference ( $ refid , $ toRefid ) ; } } // Now add all references that are not defined in the // subproject, if inheritRefs is true if ( $ this -> inheritRefs ) { // get the keys that are were not used by the subproject $ unusedRefKeys = array_diff ( array_keys ( $ projReferences ) , $ subprojRefKeys ) ; foreach ( $ unusedRefKeys as $ key ) { if ( isset ( $ newReferences [ $ key ] ) ) { continue ; } $ this -> copyReference ( $ key , $ key ) ; } } }
Add the references explicitly defined as nested elements to the
new project.  Also copy over all references that don't override
existing references in the new project if inheritrefs has been
requested.

@return void
@throws BuildException
Add the references explicitly defined as nested elements to the new project . Also copy over all references that don t override existing references in the new project if inheritrefs has been requested .