1
0
Fork 0
composer/src/Composer/Repository/RepositoryInterface.php

75 lines
1.9 KiB
PHP
Raw Normal View History

<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
2011-04-16 12:42:35 +00:00
* 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.
*/
2011-04-17 21:32:53 +00:00
namespace Composer\Repository;
2011-09-25 12:44:05 +00:00
use Composer\Package\PackageInterface;
/**
2011-09-25 12:44:05 +00:00
* Repository interface.
*
* @author Nils Adermann <naderman@naderman.de>
2011-09-25 12:44:05 +00:00
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
interface RepositoryInterface extends \Countable
{
2011-09-25 12:44:05 +00:00
/**
* Checks if specified package registered (installed).
*
2012-05-22 10:07:08 +00:00
* @param PackageInterface $package package instance
2011-09-25 12:44:05 +00:00
*
2012-06-23 09:58:18 +00:00
* @return bool
2011-09-25 12:44:05 +00:00
*/
2012-05-22 15:13:15 +00:00
public function hasPackage(PackageInterface $package);
2011-09-25 12:44:05 +00:00
/**
* Searches for the first match of a package by name and version.
*
2012-05-22 10:07:08 +00:00
* @param string $name package name
* @param string $version package version
*
2012-05-22 10:07:08 +00:00
* @return PackageInterface|null
*/
2012-05-22 15:13:15 +00:00
public function findPackage($name, $version);
/**
* Searches for all packages matching a name and optionally a version.
*
2012-05-22 10:07:08 +00:00
* @param string $name package name
* @param string $version package version
*
2012-05-22 10:07:08 +00:00
* @return array
*/
2012-05-22 15:13:15 +00:00
public function findPackages($name, $version = null);
/**
* Filters all the packages throuhg a callback
*
* The packages are not guaranteed to be instances in the repository
* and this can only be used for streaming through a list of packages.
*
* If the callback returns false, the process stops
*
* @param callable $callback
* @param string $class
* @return bool false if the process was interrupted, true otherwise
*/
public function filterPackages($callback, $class = 'Composer\Package\Package');
2011-09-25 12:44:05 +00:00
/**
* Returns list of registered packages.
*
2012-05-22 10:07:08 +00:00
* @return array
2011-09-25 12:44:05 +00:00
*/
2012-05-22 15:13:15 +00:00
public function getPackages();
}