Composer API
Class

Composer\Repository\InstalledArrayRepository

class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface

Installed array repository.

This is used for serving the RootPackage inside an in-memory InstalledRepository

Methods

__construct(array $packages = array())

from ArrayRepository
PackageInterface|null findPackage(string $name, string $version)

Searches for the first match of a package by name and version.

from ArrayRepository
array findPackages(string $name, string $version = null)

Searches for all packages matching a name and optionally a version.

from ArrayRepository
array[] search(string $query, int $mode)

Searches the repository for packages containing the query

from ArrayRepository
bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

from ArrayRepository
addPackage(PackageInterface $package)

Adds a new package to the repository

from ArrayRepository
removePackage(PackageInterface $package)

Removes package from repository.

from ArrayRepository
array getPackages()

Returns list of registered packages.

from ArrayRepository
int count()

Returns the number of packages in this repository

from ArrayRepository
write()

Writes repository (f.e.

from WritableArrayRepository
reload()

Forces a reload of all packages

from WritableArrayRepository
PackageInterface[] getCanonicalPackages()

Get unique packages, with aliases resolved and removed

from WritableArrayRepository

Details

in ArrayRepository at line 29
public __construct(array $packages = array())

Parameters

array $packages

in ArrayRepository at line 39
public PackageInterface|null findPackage(string $name, string $version)

Searches for the first match of a package by name and version.

Parameters

string $name package name
string $version package version

Return Value

PackageInterface|null

in ArrayRepository at line 56
public array findPackages(string $name, string $version = null)

Searches for all packages matching a name and optionally a version.

Parameters

string $name package name
string $version package version

Return Value

array

Searches the repository for packages containing the query

Parameters

string $query search query
int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only

Return Value

array[] an array of array('name' => '...', 'description' => '...')

in ArrayRepository at line 107
public bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

Parameters

PackageInterface $package package instance

Return Value

bool

in ArrayRepository at line 125
public addPackage(PackageInterface $package)

Adds a new package to the repository

Parameters

PackageInterface $package

in ArrayRepository at line 151
public removePackage(PackageInterface $package)

Removes package from repository.

Parameters

PackageInterface $package package instance

in ArrayRepository at line 167
public array getPackages()

Returns list of registered packages.

Return Value

array

in ArrayRepository at line 181
public int count()

Returns the number of packages in this repository

Return Value

int Number of packages

public write()

Writes repository (f.e.

to the disc).

public reload()

Forces a reload of all packages

public PackageInterface[] getCanonicalPackages()

Get unique packages, with aliases resolved and removed

Return Value

PackageInterface[]