Locker
in package
Reads/writes project lockfile (composer.lock).
Tags
Table of Contents
- $contentHash : mixed
- $dumper : mixed
- $hash : mixed
- $installationManager : mixed
- $loader : mixed
- $lockDataCache : mixed
- $lockFile : mixed
- $process : mixed
- $repositoryManager : mixed
- __construct() : mixed
- Initializes packages locker.
- getAliases() : mixed
- getContentHash() : string
- Returns the md5 hash of the sorted content of the composer file.
- getLockData() : mixed
- getLockedRepository() : RepositoryInterface
- Searches and returns an array of locked packages, retrieved from registered repositories.
- getMinimumStability() : mixed
- getPlatformOverrides() : mixed
- getPlatformRequirements() : array<string|int, Link>
- Returns the platform requirements stored in the lock file
- getPreferLowest() : mixed
- getPreferStable() : mixed
- getStabilityFlags() : mixed
- isFresh() : bool
- Checks whether the lock file is still up to date with the current hash
- isLocked() : bool
- Checks whether locker has been locked (lockfile found).
- setLockData() : bool
- Locks provided data into lockfile.
- getPackageTime() : string|null
- Returns the packages's datetime for its source reference.
- lockPackages() : mixed
Properties
$contentHash
private
mixed
$contentHash
$dumper
private
mixed
$dumper
$hash
private
mixed
$hash
$installationManager
private
mixed
$installationManager
$loader
private
mixed
$loader
$lockDataCache
private
mixed
$lockDataCache
$lockFile
private
mixed
$lockFile
$process
private
mixed
$process
$repositoryManager
private
mixed
$repositoryManager
Methods
__construct()
Initializes packages locker.
public
__construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, string $composerFileContents) : mixed
Parameters
- $io : IOInterface
- $lockFile : JsonFile
-
lockfile loader
- $repositoryManager : RepositoryManager
-
repository manager instance
- $installationManager : InstallationManager
-
installation manager instance
- $composerFileContents : string
-
The contents of the composer file
Return values
mixed —getAliases()
public
getAliases() : mixed
Return values
mixed —getContentHash()
Returns the md5 hash of the sorted content of the composer file.
public
static getContentHash(string $composerFileContents) : string
Parameters
- $composerFileContents : string
-
The contents of the composer file.
Return values
string —getLockData()
public
getLockData() : mixed
Return values
mixed —getLockedRepository()
Searches and returns an array of locked packages, retrieved from registered repositories.
public
getLockedRepository([bool $withDevReqs = false ]) : RepositoryInterface
Parameters
- $withDevReqs : bool = false
-
true to retrieve the locked dev packages
Tags
Return values
RepositoryInterface —getMinimumStability()
public
getMinimumStability() : mixed
Return values
mixed —getPlatformOverrides()
public
getPlatformOverrides() : mixed
Return values
mixed —getPlatformRequirements()
Returns the platform requirements stored in the lock file
public
getPlatformRequirements([bool $withDevReqs = false ]) : array<string|int, Link>
Parameters
- $withDevReqs : bool = false
-
if true, the platform requirements from the require-dev block are also returned
Return values
array<string|int, Link> —getPreferLowest()
public
getPreferLowest() : mixed
Return values
mixed —getPreferStable()
public
getPreferStable() : mixed
Return values
mixed —getStabilityFlags()
public
getStabilityFlags() : mixed
Return values
mixed —isFresh()
Checks whether the lock file is still up to date with the current hash
public
isFresh() : bool
Return values
bool —isLocked()
Checks whether locker has been locked (lockfile found).
public
isLocked() : bool
Return values
bool —setLockData()
Locks provided data into lockfile.
public
setLockData(array<string|int, mixed> $packages, mixed $devPackages, array<string|int, mixed> $platformReqs, mixed $platformDevReqs, array<string|int, mixed> $aliases, string $minimumStability, array<string|int, mixed> $stabilityFlags, bool $preferStable, bool $preferLowest, array<string|int, mixed> $platformOverrides) : bool
Parameters
- $packages : array<string|int, mixed>
-
array of packages
- $devPackages : mixed
-
array of dev packages or null if installed without --dev
- $platformReqs : array<string|int, mixed>
-
array of package name => constraint for required platform packages
- $platformDevReqs : mixed
-
array of package name => constraint for dev-required platform packages
- $aliases : array<string|int, mixed>
-
array of aliases
- $minimumStability : string
- $stabilityFlags : array<string|int, mixed>
- $preferStable : bool
- $preferLowest : bool
- $platformOverrides : array<string|int, mixed>
Return values
bool —getPackageTime()
Returns the packages's datetime for its source reference.
private
getPackageTime(PackageInterface $package) : string|null
Parameters
- $package : PackageInterface
-
The package to scan.
Return values
string|null —The formatted datetime or null if none was found.
lockPackages()
private
lockPackages(array<string|int, mixed> $packages) : mixed
Parameters
- $packages : array<string|int, mixed>