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

74 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>
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
interface RepositoryInterface extends \Countable
{
const SEARCH_FULLTEXT = 0;
const SEARCH_NAME = 1;
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);
/**
* Returns list of registered packages.
*
* @return array
*/
public function getPackages();
2011-09-25 12:44:05 +00:00
/**
* Searches the repository for packages containing the query
2011-09-25 12:44:05 +00:00
*
2013-06-13 11:28:24 +00:00
* @param string $query search query
* @param int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only
* @return array[] an array of array('name' => '...', 'description' => '...')
2011-09-25 12:44:05 +00:00
*/
public function search($query, $mode = 0);
}