1 | <?php |
||
15 | class PackagesOrderer |
||
16 | { |
||
17 | /** |
||
18 | * Method: go through the tree, loading child first. |
||
19 | * Each time we go through a package, lets ensure the package is not already part of the packages to install. |
||
20 | * If so, ignore. |
||
21 | * |
||
22 | * @param PackageInterface[] $unorderedPackagesList |
||
23 | * |
||
24 | * @return array|PackageInterface[] |
||
25 | */ |
||
26 | public static function reorderPackages(array $unorderedPackagesList) : array |
||
41 | |||
42 | /** |
||
43 | * Function used to sort packages by dependencies (packages depending from no other package in front of others) |
||
44 | * Invariant hypothesis for this function: $orderedPackagesList is already ordered and the package we add |
||
45 | * has all its dependencies already accounted for. If not, we add the dependencies first. |
||
46 | * |
||
47 | * @param PackageInterface $package |
||
48 | * @param PackageInterface[] $orderedPackagesList The list of sorted packages |
||
49 | * @param PackageInterface[] $availablePackages The list of all packages not yet sorted |
||
50 | * |
||
51 | * @return PackageInterface[] |
||
52 | */ |
||
53 | private static function walkPackagesList(PackageInterface $package, array $orderedPackagesList, array &$availablePackages) : array |
||
85 | } |
||
86 |