mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Update naming of repositories
This commit is contained in:
parent
6dbec8718d
commit
3da43e751d
3 changed files with 12 additions and 12 deletions
56
src/Composer/Repository/ArrayRepository.php
Normal file
56
src/Composer/Repository/ArrayRepository.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* A repository implementation that simply stores packages in an array
|
||||
*
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class ArrayRepository implements RepositoryInterface
|
||||
{
|
||||
protected $packages = array();
|
||||
|
||||
/**
|
||||
* Adds a new package to the repository
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
*/
|
||||
public function addPackage(PackageInterface $package)
|
||||
{
|
||||
$package->setRepository($this);
|
||||
$this->packages[] = $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all contained packages
|
||||
*
|
||||
* @return array All packages
|
||||
*/
|
||||
public function getPackages()
|
||||
{
|
||||
return $this->packages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of packages in this repository
|
||||
*
|
||||
* @return int Number of packages
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->packages);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue