protected function sortModules()
    {
        uasort($this->modules, function ($l, $r) {
            if ($l['precedence'] !== $r['precedence'])
                return $l['precedence'] - $r['precedence'];
            return strcmp($l['path'], $r['path']);
        });
        $this->sorted = true;
    }