Example #1
0
 /**
  * Orders all packages by comparing their dependencies. By this, the packages
  * and package configurations arrays holds all packages in the correct
  * initialization order.
  *
  * @return void
  */
 protected function sortAvailablePackagesByDependencies()
 {
     $this->resolvePackageDependencies();
     $this->packageStatesConfiguration['packages'] = $this->dependencyResolver->sortPackageStatesConfigurationByDependency($this->packageStatesConfiguration['packages']);
     // Reorder the packages according to the loading order
     $newPackages = array();
     foreach (array_keys($this->packageStatesConfiguration['packages']) as $packageKey) {
         $newPackages[$packageKey] = $this->packages[$packageKey];
     }
     $this->packages = $newPackages;
 }
Example #2
0
 /**
  * Orders all packages by comparing their dependencies. By this, the packages
  * and package configurations arrays holds all packages in the correct
  * initialization order.
  *
  * @return void
  */
 protected function sortAvailablePackagesByDependencies()
 {
     $this->resolvePackageDependencies();
     // sort the packages by key at first, so we get a stable sorting of "equivalent" packages afterwards
     ksort($this->packageStatesConfiguration['packages']);
     $this->packageStatesConfiguration['packages'] = $this->dependencyResolver->sortPackageStatesConfigurationByDependency($this->packageStatesConfiguration['packages']);
     // Reorder the packages according to the loading order
     $newPackages = array();
     foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $_) {
         $newPackages[$packageKey] = $this->packages[$packageKey];
     }
     $this->packages = $newPackages;
 }
Example #3
0
 /**
  * Orders all active packages by comparing their dependencies. By this, the packages
  * and package configurations arrays holds all packages in the correct
  * initialization order.
  *
  * @return array
  */
 protected function sortActivePackagesByDependencies()
 {
     $packagesWithDependencies = $this->resolvePackageDependencies($this->packageStatesConfiguration['packages']);
     // sort the packages by key at first, so we get a stable sorting of "equivalent" packages afterwards
     ksort($packagesWithDependencies);
     $sortedPackageKeys = $this->dependencyResolver->sortPackageStatesConfigurationByDependency($packagesWithDependencies);
     // Reorder the packages according to the loading order
     $this->packageStatesConfiguration['packages'] = [];
     foreach ($sortedPackageKeys as $packageKey) {
         $this->registerActivePackage($this->packages[$packageKey]);
     }
     return $packagesWithDependencies;
 }