class PackageOrderResolver (View source)

A simple package dependency order solver. Just sorts by simple dependencies, does no checking or versions.

Properties

protected array $manifestData
protected array $packageStates
protected array $sortedPackages
protected array $unsortedPackages

Array with state information of still unsorted packages.

Methods

__construct(array $packages, array $manifestData)

No description

array
sort()

Sorts the packages and returns the sorted packages array

bool
sortPackage(string $packageKey)

Recursively sort dependencies of a package. This is a depth-first approach that recursively adds all dependent packages to the sorted list before adding the given package. Visited packages are flagged to break up cyclic dependencies.

int
sortListBefore(string $packageKey, array $packagesToLoadBefore)

Tries to sort packages from the given list before the named package key.

bool
packageRequirementIsComposerPackage(string $requirement)

Check whether the given package requirement (like "neos/flow" or "php") is a composer package or not

Details

__construct(array $packages, array $manifestData)

No description

Parameters

array $packages

The array of package states to order by dependencies

array $manifestData

The manifests of all given packages for reading dependencies

array sort()

Sorts the packages and returns the sorted packages array

Return Value

array

protected bool sortPackage(string $packageKey)

Recursively sort dependencies of a package. This is a depth-first approach that recursively adds all dependent packages to the sorted list before adding the given package. Visited packages are flagged to break up cyclic dependencies.

Parameters

string $packageKey

Package key to process

Return Value

bool

true if package was sorted; false otherwise.

protected int sortListBefore(string $packageKey, array $packagesToLoadBefore)

Tries to sort packages from the given list before the named package key.

Ignores non existing packages and any composer key without "/" (eg. "php").

Parameters

string $packageKey
array $packagesToLoadBefore

Return Value

int

protected bool packageRequirementIsComposerPackage(string $requirement)

Check whether the given package requirement (like "neos/flow" or "php") is a composer package or not

Parameters

string $requirement

the composer requirement string

Return Value

bool

true if $requirement is a composer package (contains a slash), false otherwise