src/ModuleManager.php
public function sort()
    {
        if ($this->modules) {
            $modules = [];
            $sorter = new StringSort();

            foreach ($this->modules as $slug => $module) {
                $sorter->add($slug, array_intersect(array_keys($module->getAttribute('require')), array_keys($this->modules)));
            }

            foreach ($sorter->sort() as $slug) {
                $modules[$slug] = $this->modules[$slug];
            }

            // Override modules array
            $this->modules = $modules;
        }

        return $this;
    }
public function sort()
    {
        if ($this->modules) {
            $modules = [];
            $sorter = new StringSort();

            foreach ($this->modules as $slug => $module) {
                $sorter->add($slug, array_intersect(array_keys($module->getAttribute('require')), array_keys($this->modules)));
            }

            foreach ($sorter->sort() as $slug) {
                $modules[$slug] = $this->modules[$slug];
            }

            // Override modules array
            $this->modules = $modules;
        }

        return $this;
    }
public function sort ( ) { if ( $ this -> modules ) { $ modules = [ ] ; $ sorter = new StringSort ( ) ; foreach ( $ this -> modules as $ slug => $ module ) { $ sorter -> add ( $ slug , array_intersect ( array_keys ( $ module -> getAttribute ( 'require' ) ) , array_keys ( $ this -> modules ) ) ) ; } foreach ( $ sorter -> sort ( ) as $ slug ) { $ modules [ $ slug ] = $ this -> modules [ $ slug ] ; } // Override modules array $ this -> modules = $ modules ; } return $ this ; }
Sort modules by their dependencies.

@return $this
Sort modules by their dependencies .