src/Composer/Repository/ArrayRepository.php
public function addPackage(PackageInterface $package)
    {
        if (null === $this->packages) {
            $this->initialize();
        }
        $package->setRepository($this);
        $this->packages[] = $package;

        if ($package instanceof AliasPackage) {
            $aliasedPackage = $package->getAliasOf();
            if (null === $aliasedPackage->getRepository()) {
                $this->addPackage($aliasedPackage);
            }
        }
    }
public function addPackage(PackageInterface $package)
    {
        if (null === $this->packages) {
            $this->initialize();
        }
        $package->setRepository($this);
        $this->packages[] = $package;

        if ($package instanceof AliasPackage) {
            $aliasedPackage = $package->getAliasOf();
            if (null === $aliasedPackage->getRepository()) {
                $this->addPackage($aliasedPackage);
            }
        }
    }
public function addPackage ( PackageInterface $ package ) { if ( null === $ this -> packages ) { $ this -> initialize ( ) ; } $ package -> setRepository ( $ this ) ; $ this -> packages [ ] = $ package ; if ( $ package instanceof AliasPackage ) { $ aliasedPackage = $ package -> getAliasOf ( ) ; if ( null === $ aliasedPackage -> getRepository ( ) ) { $ this -> addPackage ( $ aliasedPackage ) ; } } }
Adds a new package to the repository

@param PackageInterface $package
Adds a new package to the repository