VersionSelector
in package
Selects the best possible version for a package
Tags
Table of Contents
- $parser : mixed
- $pool : mixed
- __construct() : mixed
- findBestCandidate() : PackageInterface|bool
- Given a package name and optional version, returns the latest PackageInterface that matches.
- findRecommendedRequireVersion() : string
- Given a concrete version, this returns a ~ constraint (when possible) that should be used, for example, in composer.json.
- getParser() : mixed
- transformVersion() : mixed
Properties
$parser
private
mixed
$parser
$pool
private
mixed
$pool
Methods
__construct()
public
__construct(Pool $pool) : mixed
Parameters
- $pool : Pool
Return values
mixed —findBestCandidate()
Given a package name and optional version, returns the latest PackageInterface that matches.
public
findBestCandidate(string $packageName[, string $targetPackageVersion = null ][, string $targetPhpVersion = null ][, string $preferredStability = 'stable' ]) : PackageInterface|bool
Parameters
- $packageName : string
- $targetPackageVersion : string = null
- $targetPhpVersion : string = null
- $preferredStability : string = 'stable'
Return values
PackageInterface|bool —findRecommendedRequireVersion()
Given a concrete version, this returns a ~ constraint (when possible) that should be used, for example, in composer.json.
public
findRecommendedRequireVersion(PackageInterface $package) : string
For example:
- 1.2.1 -> ^1.2
- 1.2 -> ^1.2
- v3.2.1 -> ^3.2
- 2.0-beta.1 -> ^2.0@beta
- dev-master -> ^2.1@dev (dev version with alias)
- dev-master -> dev-master (dev versions are untouched)
Parameters
- $package : PackageInterface
Return values
string —getParser()
private
getParser() : mixed
Return values
mixed —transformVersion()
private
transformVersion(mixed $version, mixed $prettyVersion, mixed $stability) : mixed
Parameters
- $version : mixed
- $prettyVersion : mixed
- $stability : mixed