public function sort()
    {
        $order = static::config()->uninherited('module_priority');
        $project = static::config()->get('project');

        /* @var PrioritySorter $sorter */
        $sorter = Injector::inst()->createWithArgs(
            PrioritySorter::class . '.modulesorter',
            [
                $this->modules,
                $order ?: []
            ]
        );

        if ($project) {
            $sorter->setVariable(self::PROJECT_KEY, $project);
        }

        $this->modules = $sorter->getSortedList();
    }