PlatformRepository
extends ArrayRepository
in package
A repository implementation that simply stores packages in an array
Tags
Table of Contents
- PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD'
- $packageMap : array<string|int, PackageInterface>
- $packages : array<string|int, PackageInterface>
- $overrides : array<string|int, mixed>
- Defines overrides so that the platform can be mocked
- $process : mixed
- $versionParser : mixed
- __construct() : mixed
- addPackage() : mixed
- Adds a new package to the repository
- count() : int
- Returns the number of packages in this repository
- findPackage() : mixed
- {@inheritDoc}
- findPackages() : mixed
- {@inheritDoc}
- getDependents() : array<string|int, mixed>
- Returns a list of links causing the requested needle packages to be installed, as an associative array with the dependent's name as key, and an array containing in order the PackageInterface and Link describing the relationship as values. If recursive lookup was requested a third value is returned containing an identically formed array up to the root package. That third value will be false in case a circular recursion was detected.
- getPackages() : mixed
- {@inheritDoc}
- hasPackage() : mixed
- {@inheritDoc}
- removePackage() : mixed
- Removes package from repository.
- search() : mixed
- {@inheritDoc}
- createAliasPackage() : mixed
- initialize() : mixed
- Initializes the packages array. Mostly meant as an extension point.
- addExtension() : mixed
- Parses the version and adds a new package to the repository
- addOverriddenPackage() : mixed
- buildPackageName() : mixed
Constants
PLATFORM_PACKAGE_REGEX
public
mixed
PLATFORM_PACKAGE_REGEX
= '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD'
Properties
$packageMap
protected
array<string|int, PackageInterface>
$packageMap
indexed by package unique name and used to cache hasPackage calls
$packages
protected
array<string|int, PackageInterface>
$packages
$overrides
Defines overrides so that the platform can be mocked
private
array<string|int, mixed>
$overrides
= array()
Should be an array of package name => version number mappings
$process
private
mixed
$process
$versionParser
private
mixed
$versionParser
Methods
__construct()
public
__construct([array<string|int, mixed> $packages = array() ][, array<string|int, mixed> $overrides = array() ][, ProcessExecutor $process = null ]) : mixed
Parameters
- $packages : array<string|int, mixed> = array()
- $overrides : array<string|int, mixed> = array()
- $process : ProcessExecutor = null
Return values
mixed —addPackage()
Adds a new package to the repository
public
addPackage(PackageInterface $package) : mixed
Parameters
- $package : PackageInterface
Return values
mixed —count()
Returns the number of packages in this repository
public
count() : int
Return values
int —Number of packages
findPackage()
{@inheritDoc}
public
findPackage(mixed $name, mixed $constraint) : mixed
Parameters
- $name : mixed
- $constraint : mixed
Return values
mixed —findPackages()
{@inheritDoc}
public
findPackages(mixed $name[, mixed $constraint = null ]) : mixed
Parameters
- $name : mixed
- $constraint : mixed = null
Return values
mixed —getDependents()
Returns a list of links causing the requested needle packages to be installed, as an associative array with the dependent's name as key, and an array containing in order the PackageInterface and Link describing the relationship as values. If recursive lookup was requested a third value is returned containing an identically formed array up to the root package. That third value will be false in case a circular recursion was detected.
public
getDependents(string|array<string|int, string> $needle[, ConstraintInterface|null $constraint = null ][, bool $invert = false ][, bool $recurse = true ][, array<string|int, string> $packagesFound = null ]) : array<string|int, mixed>
Parameters
- $needle : string|array<string|int, string>
-
The package name(s) to inspect.
- $constraint : ConstraintInterface|null = null
-
Optional constraint to filter by.
- $invert : bool = false
-
Whether to invert matches to discover reasons for the package NOT to be installed.
- $recurse : bool = true
-
Whether to recursively expand the requirement tree up to the root package.
- $packagesFound : array<string|int, string> = null
-
Used internally when recurring
Return values
array<string|int, mixed> —An associative array of arrays as described above.
getPackages()
{@inheritDoc}
public
getPackages() : mixed
Return values
mixed —hasPackage()
{@inheritDoc}
public
hasPackage(PackageInterface $package) : mixed
Parameters
- $package : PackageInterface
Return values
mixed —removePackage()
Removes package from repository.
public
removePackage(PackageInterface $package) : mixed
Parameters
- $package : PackageInterface
-
package instance
Return values
mixed —search()
{@inheritDoc}
public
search(mixed $query, mixed $mode[, mixed $type = null ]) : mixed
Parameters
- $query : mixed
- $mode : mixed
- $type : mixed = null
Return values
mixed —createAliasPackage()
protected
createAliasPackage(PackageInterface $package, mixed $alias, mixed $prettyAlias) : mixed
Parameters
- $package : PackageInterface
- $alias : mixed
- $prettyAlias : mixed
Return values
mixed —initialize()
Initializes the packages array. Mostly meant as an extension point.
protected
initialize() : mixed
Return values
mixed —addExtension()
Parses the version and adds a new package to the repository
private
addExtension(string $name, null|string $prettyVersion) : mixed
Parameters
- $name : string
- $prettyVersion : null|string
Return values
mixed —addOverriddenPackage()
private
addOverriddenPackage(array<string|int, mixed> $override[, mixed $name = null ]) : mixed
Parameters
- $override : array<string|int, mixed>
- $name : mixed = null
Return values
mixed —buildPackageName()
private
buildPackageName(mixed $name) : mixed
Parameters
- $name : mixed